[PATCH] madvise.2: Add MADV_FREE

From: Minchan Kim
Date: Thu Feb 04 2016 - 21:09:54 EST


Document the MADV_FREE flags added to madvise() in Linux 4.5

Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx>
---
man2/madvise.2 | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/man2/madvise.2 b/man2/madvise.2
index c1df67c..4704304 100644
--- a/man2/madvise.2
+++ b/man2/madvise.2
@@ -143,6 +143,25 @@ flag are special memory areas that are not managed
by the virtual memory subsystem.
Such pages are typically created by device drivers that
map the pages into user space.)
+.TP
+.B MADV_FREE " (since Linux 4.5)"
+Application is finished with the given range, so kernel can free
+resources associated with it but the freeing could be delayed until
+memory pressure happens or canceld by write operation by user.
+
+After a successful MADV_FREE operation, user shouldn't expect kernel
+keeps stale data on the page. However, subsequent write of pages
+in the range will succeed and then kernel cannot free those dirtied pages
+so user can always see just written data. If there was no subsequent
+write, kernel can free those clean pages any time. In such case,
+user can see zero-fill-on-demand pages.
+
+Note that, it works only with private anonymous pages (see
+.BR mmap (2)).
+On swapless system, freeing pages in given range happens instantly
+regardless of memory pressure.
+
+
.\"
.\" ======================================================================
.\"
--
1.9.1