diff mbox series

Define MADV_COLLAPSE from Linux 6.1

Message ID 3026a082-68e8-d5be-9fcd-9f35a4239253@codesourcery.com
State New
Headers show
Series Define MADV_COLLAPSE from Linux 6.1 | expand

Commit Message

Joseph Myers Dec. 21, 2022, 5:47 p.m. UTC
Add the MADV_COLLAPSE constant from Linux 6.1 to bits/mman-linux.h and
the hppa bits/mman.h.

Tested for x86_64.

Comments

Florian Weimer Dec. 22, 2022, 8:46 a.m. UTC | #1
* Joseph Myers:

> Add the MADV_COLLAPSE constant from Linux 6.1 to bits/mman-linux.h and
> the hppa bits/mman.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 1fb7f888aa..c3818ce356 100644
> --- a/sysdeps/unix/sysv/linux/bits/mman-linux.h
> +++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h
> @@ -91,6 +91,7 @@
>  				   writable.  */
>  # define MADV_DONTNEED_LOCKED 24 /* Like MADV_DONTNEED, but drop
>  				    locked pages too.  */
> +# define MADV_COLLAPSE    25	/* Synchronous hugepage collapse.  */
>  # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
>  #endif
>  
> diff --git a/sysdeps/unix/sysv/linux/hppa/bits/mman.h b/sysdeps/unix/sysv/linux/hppa/bits/mman.h
> index acaa1cc3e7..1d895a5234 100644
> --- a/sysdeps/unix/sysv/linux/hppa/bits/mman.h
> +++ b/sysdeps/unix/sysv/linux/hppa/bits/mman.h
> @@ -79,4 +79,6 @@
>  # define MADV_WIPEONFORK 71	/* Zero memory on fork, child only.  */
>  # undef MADV_KEEPONFORK
>  # define MADV_KEEPONFORK 72	/* Undo MADV_WIPEONFORK.  */
> +# undef MADV_COLLAPSE
> +# define MADV_COLLAPSE   73	/* Synchronous hugepage collapse.  */
>  #endif

Linux parisc now has:

commit 71bdea6f798b425bc0003780b13e3fdecb16a010
Author: Helge Deller <deller@gmx.de>
Date:   Sun Dec 11 19:50:20 2022 +0100

    parisc: Align parisc MADV_XXX constants with all other architectures
    
    Adjust some MADV_XXX constants to be in sync what their values are on
    all other platforms. There is currently no reason to have an own
    numbering on parisc, but it requires workarounds in many userspace
    sources (e.g. glibc, qemu, ...) - which are often forgotten and thus
    introduce bugs and different behaviour on parisc.
    
    A wrapper avoids an ABI breakage for existing userspace applications by
    translating any old values to the new ones, so this change allows us to
    move over all programs to the new ABI over time.
    
    Signed-off-by: Helge Deller <deller@gmx.de>

But the 73 value still works, and the mentioned commit is not in 6.1, so
your change looks okay to me.

Thanks,
Florian
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h
index 1fb7f888aa..c3818ce356 100644
--- a/sysdeps/unix/sysv/linux/bits/mman-linux.h
+++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h
@@ -91,6 +91,7 @@ 
 				   writable.  */
 # define MADV_DONTNEED_LOCKED 24 /* Like MADV_DONTNEED, but drop
 				    locked pages too.  */
+# define MADV_COLLAPSE    25	/* Synchronous hugepage collapse.  */
 # define MADV_HWPOISON	  100	/* Poison a page for testing.  */
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/mman.h b/sysdeps/unix/sysv/linux/hppa/bits/mman.h
index acaa1cc3e7..1d895a5234 100644
--- a/sysdeps/unix/sysv/linux/hppa/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/hppa/bits/mman.h
@@ -79,4 +79,6 @@ 
 # define MADV_WIPEONFORK 71	/* Zero memory on fork, child only.  */
 # undef MADV_KEEPONFORK
 # define MADV_KEEPONFORK 72	/* Undo MADV_WIPEONFORK.  */
+# undef MADV_COLLAPSE
+# define MADV_COLLAPSE   73	/* Synchronous hugepage collapse.  */
 #endif