Patchwork Define MADV_COLD and MADV_PAGEOUT from Linux 5.4

login
register
mail settings
Submitter Joseph Myers
Date Nov. 27, 2019, 11:45 p.m.
Message ID <alpine.DEB.2.21.1911272345240.14409@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/36335/
State New
Headers show

Comments

Joseph Myers - Nov. 27, 2019, 11:45 p.m.
Linux 5.4 adds constants MADV_COLD and MADV_PAGEOUT (defined with the
same values on all architectures).  This patch adds them to
bits/mman-linux.h.

Tested for x86_64.
Florian Weimer - Nov. 28, 2019, 6:50 a.m.
* Joseph Myers:

> Linux 5.4 adds constants MADV_COLD and MADV_PAGEOUT (defined with the
> same values on all architectures).  This patch adds them to
> bits/mman-linux.h.
>
> Tested for x86_64.
>
> diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h
> b/sysdeps/unix/sysv/linux/bits/mman-linux.h
> index d6755c59d5..c0b11bfe24 100644
> --- a/sysdeps/unix/sysv/linux/bits/mman-linux.h
> +++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h
> @@ -87,6 +87,8 @@
>  # define MADV_DODUMP	  17	/* Clear the MADV_DONTDUMP flag.  */
>  # define MADV_WIPEONFORK  18	/* Zero memory on fork, child only.  */
>  # define MADV_KEEPONFORK  19	/* Undo MADV_WIPEONFORK.  */
> +# define MADV_COLD        20	/* Deactivate these pages.  */
> +# define MADV_PAGEOUT     21	/* Reclaim these pages.  */
>  # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
>  #endif

I've verified that this matches what's in the UAPI headers.  Looks good.

Patch

diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h
index d6755c59d5..c0b11bfe24 100644
--- a/sysdeps/unix/sysv/linux/bits/mman-linux.h
+++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h
@@ -87,6 +87,8 @@ 
 # define MADV_DODUMP	  17	/* Clear the MADV_DONTDUMP flag.  */
 # define MADV_WIPEONFORK  18	/* Zero memory on fork, child only.  */
 # define MADV_KEEPONFORK  19	/* Undo MADV_WIPEONFORK.  */
+# define MADV_COLD        20	/* Deactivate these pages.  */
+# define MADV_PAGEOUT     21	/* Reclaim these pages.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif