public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Define MADV_COLLAPSE from Linux 6.1
@ 2022-12-21 17:47 Joseph Myers
  2022-12-22  8:46 ` Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2022-12-21 17:47 UTC (permalink / raw)
  To: libc-alpha

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

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Define MADV_COLLAPSE from Linux 6.1
  2022-12-21 17:47 Define MADV_COLLAPSE from Linux 6.1 Joseph Myers
@ 2022-12-22  8:46 ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2022-12-22  8:46 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

* 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-22  8:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-21 17:47 Define MADV_COLLAPSE from Linux 6.1 Joseph Myers
2022-12-22  8:46 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).