diff mbox series

[6/6] linux: Add MAP_DROPPABLE from Linux 6.11

Message ID 20241008132440.722309-7-adhemerval.zanella@linaro.org
State New
Headers show
Series Updates for Linux 6.11 | expand

Commit Message

Adhemerval Zanella Oct. 8, 2024, 1:23 p.m. UTC
This request the page to be never written out to swap, it will be zeroed
under memory pressure (so kernel can just drop the page), it is inherited
by fork, it is not counted against @code{mlock} budget, and if there is
no enough memory to service a page faults there is no fatal error (so not
signal is sent).

Tested with build-many-glibcs.py.
---
 manual/llio.texi                          | 9 +++++++++
 sysdeps/unix/sysv/linux/bits/mman-linux.h | 1 +
 2 files changed, 10 insertions(+)

Comments

Andreas Schwab Oct. 8, 2024, 1:40 p.m. UTC | #1
On Okt 08 2024, Adhemerval Zanella wrote:

> +@item MAP_DROPPABLE
> +This request the page to be never written out to swap, it will be zeroed

Remove "This".

> +under memory pressure (so kernel can just drop the page), it is inherited
> +by fork, it is not counted against @code{mlock} budget, and if there is
> +no enough memory to service a page faults there is no fatal error (so not

no -> not, faults -> fault, not -> no

> +signal is sent).
diff mbox series

Patch

diff --git a/manual/llio.texi b/manual/llio.texi
index a035c3e20f..c8e6e07ea0 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -1762,6 +1762,15 @@  write dirty metadata out whenever dirty data is written out.  Unlike
 most other flags, this one will fail unless @code{MAP_SHARED_VALIDATE}
 is also given.
 
+@item MAP_DROPPABLE
+This request the page to be never written out to swap, it will be zeroed
+under memory pressure (so kernel can just drop the page), it is inherited
+by fork, it is not counted against @code{mlock} budget, and if there is
+no enough memory to service a page faults there is no fatal error (so not
+signal is sent).
+
+The @code{MAP_DROPPABLE} flag is specific to Linux.
+
 @end vtable
 
 @code{mmap} returns the address of the new mapping, or
diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h
index 522333c50a..161a885096 100644
--- a/sysdeps/unix/sysv/linux/bits/mman-linux.h
+++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h
@@ -43,6 +43,7 @@ 
 #define MAP_PRIVATE	0x02		/* Changes are private.  */
 #define MAP_SHARED_VALIDATE	0x03	/* Share changes and validate
 					   extension flags.  */
+#define MAP_DROPPABLE	0x08		/* Zero memory under memory pressure.  */
 #define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
 
 /* Other flags.  */