diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20231108: vm_page_dontneed.9 renamed to vm_page_advise.9 +OLD_FILES+=usr/share/man/man9/vm_page_dontneed.9.gz + # 20231018: pmc.k7(3) removed OLD_FILES+=usr/share/man/man3/pmc.k7.3.gz diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -397,10 +397,10 @@ vm_map_submap.9 \ vm_map_sync.9 \ vm_map_wire.9 \ + vm_page_advise.9 \ vm_page_alloc.9 \ vm_page_bits.9 \ vm_page_busy.9 \ - vm_page_dontneed.9 \ vm_page_aflag.9 \ vm_page_free.9 \ vm_page_grab.9 \ diff --git a/share/man/man9/vm_page_dontneed.9 b/share/man/man9/vm_page_advise.9 rename from share/man/man9/vm_page_dontneed.9 rename to share/man/man9/vm_page_advise.9 --- a/share/man/man9/vm_page_dontneed.9 +++ b/share/man/man9/vm_page_advise.9 @@ -1,5 +1,9 @@ .\" .\" Copyright (C) 2001 Chad David . All rights reserved. +.\" Copyright (c) 2023 The FreeBSD Foundation +.\" +.\" Portions of this documentation were written by Mitchell Horne +.\" under sponsorship from the FreeBSD Foundation. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -24,34 +28,61 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH .\" DAMAGE. .\" -.Dd July 30, 2001 -.Dt VM_PAGE_DONTNEED 9 +.Dd November 8, 2023 +.Dt VM_PAGE_ADVISE 9 .Os .Sh NAME -.Nm vm_page_dontneed -.Nd "indicate that a page is not needed anymore" +.Nm vm_page_advise +.Nd "apply an advisory usage hint to a page" .Sh SYNOPSIS .In sys/param.h +.In sys/mman.h .In vm/vm.h .In vm/vm_page.h .Ft void -.Fn vm_page_dontneed "vm_page_t m" +.Fn vm_page_advise "vm_page_t m" "int advice" .Sh DESCRIPTION The -.Fn vm_page_dontneed -function advises the VM system that the given page is no longer -required. -If the page is already in the inactive queue or in the cache queue, this -function does nothing; otherwise the page is deactivated. +.Fn vm_page_advise +function applies the requested advisory action to the page +.Fa m . +.Pp +The values of +.Fa advice +are defined by the +.Xr madvise 2 +system call. +Values recognized by this function are: +.Bl -tag -offset -indent -width "Dv MADV_DONTNEED" +.It Dv MADV_DONTNEED +Advise the VM system that the page denoted by +.Fa m +is not in active use, but its contents must be preserved. +The page will be put on the laundry queue if it is dirty, otherwise it will be +moved to the inactive queue. +.It Dv MADV_FREE +Advise the VM system that the contents of page +.Fa m +are no longer important, and may be discarded. +The page is marked as clean and moved to the head of the inactive list via +.Xr vm_page_deactivate_noreuse 9 . +.It Dv MADV_WILLNEED +Advise the VM system that the contents of +.Fa m +are needed and should be prioritized. +Put it on the active page queue via +.Xr vm_page_activate 9 . +.El .Pp -Note that -.Fn vm_page_dontneed -does not necessarily deactivate a page, but instead implements an -algorithm that attempts to prevent small objects from having their -pages reused too quickly, and large objects from flushing smaller -ones from the queues as their pages are released. +For any other value of +.Fa advice , +this function takes no action. .Sh SEE ALSO -.Xr vm_page_deactivate 9 +.Xr madvise 2 , +.Xr vm_page_queue 9 , +.Xr vm_page_undirty 9 .Sh AUTHORS This manual page was written by -.An Chad David Aq Mt davidc@acns.ab.ca . +.An Chad David Aq Mt davidc@acns.ab.ca +and revised by +.An Mitchell Horne Aq Mt mhorne@FreeBSD.org .