Add MAP_HUGETLB and MAP_STACK defines for hppa

Message ID 56884FB0.8030504@gmx.de
State New, archived
Headers

Commit Message

Helge Deller Jan. 2, 2016, 10:31 p.m. UTC
  The attached patch adds some upstream defines like MAP_HUGETLB and MAP_STACK 
in mman.h for the hppa architecture. 

The glibc mman.h header file for the hppa architecture (sysdeps/unix/sysv/linux/hppa/bits/mman.h)
is missing the Linux upstream defines for MAP_HUGETLB, MCL_ONFAULT, MADV_HUGEPAGE, MADV_NOHUGEPAGE,
MADV_DONTDUMP and MADV_DODUMP. Those are added by this patch.

The existing MADV_xxK_PAGES defines were dropped upstream, because they were
originally added many years ago based on a proposed patch for the Linux kernel
which was never applied. So, this patch drops those unneeded defines.

The change closes BZ #19285].

Please install if okay.

Thanks,
Helge


2016-01-02  Helge Deller  <deller@gmx.de>

        [BZ #19285]
        * sysdeps/unix/sysv/linux/hppa/bits/mman.h (MAP_STACK): Define.
        (MAP_HUGETLB, MCL_ONFAULT): Likewise.
        (MADV_HUGEPAGE, MADV_NOHUGEPAGE, MADV_DONTDUMP, MADV_DODUMP): Likewise.
        (MADV_xxK_PAGES): Remove.
  

Comments

Mike Frysinger Jan. 3, 2016, 4:50 a.m. UTC | #1
On 02 Jan 2016 23:31, Helge Deller wrote:
> The attached patch adds some upstream defines like MAP_HUGETLB and MAP_STACK 
> in mman.h for the hppa architecture. 
> 
> The glibc mman.h header file for the hppa architecture (sysdeps/unix/sysv/linux/hppa/bits/mman.h)
> is missing the Linux upstream defines for MAP_HUGETLB, MCL_ONFAULT, MADV_HUGEPAGE, MADV_NOHUGEPAGE,
> MADV_DONTDUMP and MADV_DODUMP. Those are added by this patch.
> 
> The existing MADV_xxK_PAGES defines were dropped upstream, because they were
> originally added many years ago based on a proposed patch for the Linux kernel
> which was never applied. So, this patch drops those unneeded defines.
> 
> The change closes BZ #19285].
> 
> Please install if okay.

thanks, pushed now
-mike
  
Joseph Myers Jan. 4, 2016, 3:35 p.m. UTC | #2
Please also update <https://sourceware.org/glibc/wiki/PortStatus> when 
fixing such issues (ports missing some change that involves port-specific 
changes for multiple ports) that are listed there.
  
Mike Frysinger Jan. 4, 2016, 6:20 p.m. UTC | #3
On 04 Jan 2016 15:35, Joseph Myers wrote:
> Please also update <https://sourceware.org/glibc/wiki/PortStatus> when 
> fixing such issues (ports missing some change that involves port-specific 
> changes for multiple ports) that are listed there.

done
-mike
  

Patch

2016-01-02  Helge Deller  <deller@gmx.de>

	[BZ #19285]
	* sysdeps/unix/sysv/linux/hppa/bits/mman.h (MAP_STACK): Define.
	(MAP_HUGETLB, MCL_ONFAULT): Likewise.
	(MADV_HUGEPAGE, MADV_NOHUGEPAGE, MADV_DONTDUMP, MADV_DODUMP): Likewise.
	(MADV_xxK_PAGES): Remove.

diff --git a/sysdeps/unix/sysv/linux/hppa/bits/mman.h b/sysdeps/unix/sysv/linux/hppa/bits/mman.h
index cbde4b8..561f607 100644
--- a/sysdeps/unix/sysv/linux/hppa/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/hppa/bits/mman.h
@@ -58,6 +58,8 @@ 
 # define MAP_GROWSDOWN	0x8000		/* Stack-like segment */
 # define MAP_POPULATE	0x10000		/* Populate (prefault) pagetables */
 # define MAP_NONBLOCK	0x20000		/* Do not block on IO */
+# define MAP_STACK	0x40000		/* Create for process/thread stacks */
+# define MAP_HUGETLB	0x80000		/* Create a huge page mapping */
 #endif
 
 /* Flags to "msync"  */
@@ -68,6 +70,7 @@ 
 /* Flags to "mlockall"  */
 #define MCL_CURRENT	1		/* Lock all current mappings */
 #define MCL_FUTURE	2		/* Lock all future mappings */
+#define MCL_ONFAULT	4		/* Lock all pages that are faulted in */
 
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
@@ -90,19 +93,11 @@ 
 # define MADV_DOFORK	 11	/* Do inherit across fork.  */
 # define MADV_MERGEABLE   65	/* KSM may merge identical pages */
 # define MADV_UNMERGEABLE 66	/* KSM may not merge identical pages */
-#endif
-
-/* The range 12-64 is reserved for page size specification. */
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MADV_4K_PAGES		12	/* Use 4K pages.  */
-# define MADV_16K_PAGES		14	/* Use 16K pages.  */
-# define MADV_64K_PAGES		16	/* Use 64K pages.  */
-# define MADV_256K_PAGES	18	/* Use 256K pages.  */
-# define MADV_1M_PAGES		20	/* Use 1 Megabyte pages.  */
-# define MADV_4M_PAGES		22	/* Use 4 Megabyte pages.  */
-# define MADV_16M_PAGES		24	/* Use 16 Megabyte pages.  */
-# define MADV_64M_PAGES		26	/* Use 64 Megabyte pages.  */
+# define MADV_HUGEPAGE	 67	/* Worth backing with hugepages */
+# define MADV_NOHUGEPAGE 68	/* Not worth backing with hugepages */
+# define MADV_DONTDUMP	 69	/* Explicity exclude from the core dump,
+				   overrides the coredump filter bits */
+# define MADV_DODUMP     70	/* Clear the MADV_NODUMP flag */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */