mm: add MAP_HUGETLB for mmaping pseudo-anonymous huge page regions
authorArnd Bergmann <arnd@arndb.de>
Tue, 22 Sep 2009 00:03:45 +0000 (17:03 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Sep 2009 14:17:41 +0000 (07:17 -0700)
Add a flag for mmap that will be used to request a huge page region that
will look like anonymous memory to user space.  This is accomplished by
using a file on the internal vfsmount.  MAP_HUGETLB is a modifier of
MAP_ANONYMOUS and so must be specified with it.  The region will behave
the same as a MAP_ANONYMOUS region using small pages.

The patch also adds the MAP_STACK flag, which was previously defined only
on some architectures but not on others.  Since MAP_STACK is meant to be a
hint only, architectures can define it without assigning a specific
meaning to it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Eric B Munson <ebmunson@us.ibm.com>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: David Rientjes <rientjes@google.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 files changed:
arch/alpha/include/asm/mman.h
arch/arm/include/asm/mman.h
arch/avr32/include/asm/mman.h
arch/cris/include/asm/mman.h
arch/frv/include/asm/mman.h
arch/h8300/include/asm/mman.h
arch/ia64/include/asm/mman.h
arch/m32r/include/asm/mman.h
arch/m68k/include/asm/mman.h
arch/mips/include/asm/mman.h
arch/mn10300/include/asm/mman.h
arch/parisc/include/asm/mman.h
arch/powerpc/include/asm/mman.h
arch/s390/include/asm/mman.h
arch/sparc/include/asm/mman.h
arch/xtensa/include/asm/mman.h
include/asm-generic/mman.h

index c77c557..99c56d4 100644 (file)
@@ -28,6 +28,8 @@
 #define MAP_NORESERVE  0x10000         /* don't check for reservations */
 #define MAP_POPULATE   0x20000         /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x40000         /* do not block on IO */
+#define MAP_STACK      0x80000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x100000        /* create a huge page mapping */
 
 #define MS_ASYNC       1               /* sync memory asynchronously */
 #define MS_SYNC                2               /* synchronous memory sync */
index fc26976..6464d47 100644 (file)
@@ -10,6 +10,8 @@
 #define MAP_NORESERVE  0x4000          /* don't check for reservations */
 #define MAP_POPULATE   0x8000          /* populate (prefault) page tables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */
index 9a92b15..38cea1b 100644 (file)
@@ -10,6 +10,8 @@
 #define MAP_NORESERVE  0x4000          /* don't check for reservations */
 #define MAP_POPULATE   0x8000          /* populate (prefault) page tables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */
index b7f0afb..de6b903 100644 (file)
@@ -12,6 +12,8 @@
 #define MAP_NORESERVE  0x4000          /* don't check for reservations */
 #define MAP_POPULATE   0x8000          /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */
index 58c1d11..1939343 100644 (file)
@@ -10,6 +10,8 @@
 #define MAP_NORESERVE  0x4000          /* don't check for reservations */
 #define MAP_POPULATE   0x8000          /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */
index cf35f0a..eacacd0 100644 (file)
@@ -10,6 +10,8 @@
 #define MAP_NORESERVE  0x4000          /* don't check for reservations */
 #define MAP_POPULATE   0x8000          /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */
index 48cf8b9..cf55884 100644 (file)
@@ -18,6 +18,8 @@
 #define MAP_NORESERVE  0x04000         /* don't check for reservations */
 #define MAP_POPULATE   0x08000         /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */
index 04a5f40..d191089 100644 (file)
@@ -10,6 +10,8 @@
 #define MAP_NORESERVE  0x4000          /* don't check for reservations */
 #define MAP_POPULATE   0x8000          /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */
index 9f5c4c4..c421fef 100644 (file)
@@ -10,6 +10,8 @@
 #define MAP_NORESERVE  0x4000          /* don't check for reservations */
 #define MAP_POPULATE   0x8000          /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */
index f15554d..a2250f3 100644 (file)
@@ -46,6 +46,8 @@
 #define MAP_LOCKED     0x8000          /* pages are locked */
 #define MAP_POPULATE   0x10000         /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x20000         /* do not block on IO */
+#define MAP_STACK      0x40000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x80000         /* create a huge page mapping */
 
 /*
  * Flags for msync
index d04fac1..94611c3 100644 (file)
@@ -21,6 +21,8 @@
 #define MAP_NORESERVE  0x4000          /* don't check for reservations */
 #define MAP_POPULATE   0x8000          /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */
index a12d9d4..9749c8a 100644 (file)
@@ -22,6 +22,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         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x80000         /* create a huge page mapping */
 
 #define MS_SYNC                1               /* synchronous memory sync */
 #define MS_ASYNC       2               /* sync memory asynchronously */
index 7b1c498..d4a7f64 100644 (file)
@@ -25,6 +25,8 @@
 
 #define MAP_POPULATE   0x8000          /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #ifdef __KERNEL__
 #ifdef CONFIG_PPC64
index f63fe7b..22714ca 100644 (file)
@@ -18,6 +18,8 @@
 #define MAP_NORESERVE  0x4000          /* don't check for reservations */
 #define MAP_POPULATE   0x8000          /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */
index 988192e..c3029ad 100644 (file)
@@ -20,6 +20,8 @@
 
 #define MAP_POPULATE   0x8000          /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
+#define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
index 6e55b4d..fca4db4 100644 (file)
@@ -53,6 +53,8 @@
 #define MAP_LOCKED     0x8000          /* pages are locked */
 #define MAP_POPULATE   0x10000         /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x20000         /* do not block on IO */
+#define MAP_STACK      0x40000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x80000         /* create a huge page mapping */
 
 /*
  * Flags for msync
index 7cab4de..32c8bd6 100644 (file)
@@ -11,6 +11,7 @@
 #define MAP_POPULATE   0x8000          /* populate (prefault) pagetables */
 #define MAP_NONBLOCK   0x10000         /* do not block on IO */
 #define MAP_STACK      0x20000         /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB    0x40000         /* create a huge page mapping */
 
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */