diff options
author | Arnd Bergmann <arnd@arndb.de> | 2009-09-21 20:03:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-22 10:17:41 -0400 |
commit | 90f72aa58bbf076b68e289fbd71eb829bc505923 (patch) | |
tree | 992e5f59086cc77581fa10b52fb4a46fb3baf3f0 | |
parent | 6bfde05bf5c9682e255c6a2c669dc80f91af6296 (diff) |
mm: add MAP_HUGETLB for mmaping pseudo-anonymous huge page regions
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>
-rw-r--r-- | arch/alpha/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/arm/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/avr32/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/cris/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/frv/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/h8300/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/ia64/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/m32r/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/m68k/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/mips/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/mn10300/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/parisc/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/s390/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/mman.h | 2 | ||||
-rw-r--r-- | arch/xtensa/include/asm/mman.h | 2 | ||||
-rw-r--r-- | include/asm-generic/mman.h | 1 |
17 files changed, 33 insertions, 0 deletions
diff --git a/arch/alpha/include/asm/mman.h b/arch/alpha/include/asm/mman.h index c77c55756a7c..99c56d47879d 100644 --- a/arch/alpha/include/asm/mman.h +++ b/arch/alpha/include/asm/mman.h | |||
@@ -28,6 +28,8 @@ | |||
28 | #define MAP_NORESERVE 0x10000 /* don't check for reservations */ | 28 | #define MAP_NORESERVE 0x10000 /* don't check for reservations */ |
29 | #define MAP_POPULATE 0x20000 /* populate (prefault) pagetables */ | 29 | #define MAP_POPULATE 0x20000 /* populate (prefault) pagetables */ |
30 | #define MAP_NONBLOCK 0x40000 /* do not block on IO */ | 30 | #define MAP_NONBLOCK 0x40000 /* do not block on IO */ |
31 | #define MAP_STACK 0x80000 /* give out an address that is best suited for process/thread stacks */ | ||
32 | #define MAP_HUGETLB 0x100000 /* create a huge page mapping */ | ||
31 | 33 | ||
32 | #define MS_ASYNC 1 /* sync memory asynchronously */ | 34 | #define MS_ASYNC 1 /* sync memory asynchronously */ |
33 | #define MS_SYNC 2 /* synchronous memory sync */ | 35 | #define MS_SYNC 2 /* synchronous memory sync */ |
diff --git a/arch/arm/include/asm/mman.h b/arch/arm/include/asm/mman.h index fc26976d8e3a..6464d471bc70 100644 --- a/arch/arm/include/asm/mman.h +++ b/arch/arm/include/asm/mman.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | #define MAP_POPULATE 0x8000 /* populate (prefault) page tables */ | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) page tables */ |
12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
13 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
14 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
13 | 15 | ||
14 | #define MCL_CURRENT 1 /* lock all current mappings */ | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | #define MCL_FUTURE 2 /* lock all future mappings */ | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
diff --git a/arch/avr32/include/asm/mman.h b/arch/avr32/include/asm/mman.h index 9a92b15f6a66..38cea1b597c2 100644 --- a/arch/avr32/include/asm/mman.h +++ b/arch/avr32/include/asm/mman.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | #define MAP_POPULATE 0x8000 /* populate (prefault) page tables */ | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) page tables */ |
12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
13 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
14 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
13 | 15 | ||
14 | #define MCL_CURRENT 1 /* lock all current mappings */ | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | #define MCL_FUTURE 2 /* lock all future mappings */ | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
diff --git a/arch/cris/include/asm/mman.h b/arch/cris/include/asm/mman.h index b7f0afba3ce0..de6b903b22cd 100644 --- a/arch/cris/include/asm/mman.h +++ b/arch/cris/include/asm/mman.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | 12 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
13 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | 13 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
14 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 14 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
15 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
16 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
15 | 17 | ||
16 | #define MCL_CURRENT 1 /* lock all current mappings */ | 18 | #define MCL_CURRENT 1 /* lock all current mappings */ |
17 | #define MCL_FUTURE 2 /* lock all future mappings */ | 19 | #define MCL_FUTURE 2 /* lock all future mappings */ |
diff --git a/arch/frv/include/asm/mman.h b/arch/frv/include/asm/mman.h index 58c1d11e2ac7..1939343322bb 100644 --- a/arch/frv/include/asm/mman.h +++ b/arch/frv/include/asm/mman.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
13 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
14 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
13 | 15 | ||
14 | #define MCL_CURRENT 1 /* lock all current mappings */ | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | #define MCL_FUTURE 2 /* lock all future mappings */ | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
diff --git a/arch/h8300/include/asm/mman.h b/arch/h8300/include/asm/mman.h index cf35f0a6f12e..eacacd04032e 100644 --- a/arch/h8300/include/asm/mman.h +++ b/arch/h8300/include/asm/mman.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
13 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
14 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
13 | 15 | ||
14 | #define MCL_CURRENT 1 /* lock all current mappings */ | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | #define MCL_FUTURE 2 /* lock all future mappings */ | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
diff --git a/arch/ia64/include/asm/mman.h b/arch/ia64/include/asm/mman.h index 48cf8b98a0b4..cf55884e7f39 100644 --- a/arch/ia64/include/asm/mman.h +++ b/arch/ia64/include/asm/mman.h | |||
@@ -18,6 +18,8 @@ | |||
18 | #define MAP_NORESERVE 0x04000 /* don't check for reservations */ | 18 | #define MAP_NORESERVE 0x04000 /* don't check for reservations */ |
19 | #define MAP_POPULATE 0x08000 /* populate (prefault) pagetables */ | 19 | #define MAP_POPULATE 0x08000 /* populate (prefault) pagetables */ |
20 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 20 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
21 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
22 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
21 | 23 | ||
22 | #define MCL_CURRENT 1 /* lock all current mappings */ | 24 | #define MCL_CURRENT 1 /* lock all current mappings */ |
23 | #define MCL_FUTURE 2 /* lock all future mappings */ | 25 | #define MCL_FUTURE 2 /* lock all future mappings */ |
diff --git a/arch/m32r/include/asm/mman.h b/arch/m32r/include/asm/mman.h index 04a5f40aa401..d191089808f4 100644 --- a/arch/m32r/include/asm/mman.h +++ b/arch/m32r/include/asm/mman.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
13 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
14 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
13 | 15 | ||
14 | #define MCL_CURRENT 1 /* lock all current mappings */ | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | #define MCL_FUTURE 2 /* lock all future mappings */ | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
diff --git a/arch/m68k/include/asm/mman.h b/arch/m68k/include/asm/mman.h index 9f5c4c4b3c7b..c421fef55f5e 100644 --- a/arch/m68k/include/asm/mman.h +++ b/arch/m68k/include/asm/mman.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
13 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
14 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
13 | 15 | ||
14 | #define MCL_CURRENT 1 /* lock all current mappings */ | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | #define MCL_FUTURE 2 /* lock all future mappings */ | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
diff --git a/arch/mips/include/asm/mman.h b/arch/mips/include/asm/mman.h index f15554d1518a..a2250f390a29 100644 --- a/arch/mips/include/asm/mman.h +++ b/arch/mips/include/asm/mman.h | |||
@@ -46,6 +46,8 @@ | |||
46 | #define MAP_LOCKED 0x8000 /* pages are locked */ | 46 | #define MAP_LOCKED 0x8000 /* pages are locked */ |
47 | #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ | 47 | #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ |
48 | #define MAP_NONBLOCK 0x20000 /* do not block on IO */ | 48 | #define MAP_NONBLOCK 0x20000 /* do not block on IO */ |
49 | #define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */ | ||
50 | #define MAP_HUGETLB 0x80000 /* create a huge page mapping */ | ||
49 | 51 | ||
50 | /* | 52 | /* |
51 | * Flags for msync | 53 | * Flags for msync |
diff --git a/arch/mn10300/include/asm/mman.h b/arch/mn10300/include/asm/mman.h index d04fac1da5aa..94611c356bb4 100644 --- a/arch/mn10300/include/asm/mman.h +++ b/arch/mn10300/include/asm/mman.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | 21 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
22 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | 22 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
23 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 23 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
24 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
25 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
24 | 26 | ||
25 | #define MCL_CURRENT 1 /* lock all current mappings */ | 27 | #define MCL_CURRENT 1 /* lock all current mappings */ |
26 | #define MCL_FUTURE 2 /* lock all future mappings */ | 28 | #define MCL_FUTURE 2 /* lock all future mappings */ |
diff --git a/arch/parisc/include/asm/mman.h b/arch/parisc/include/asm/mman.h index a12d9d43f507..9749c8afe83a 100644 --- a/arch/parisc/include/asm/mman.h +++ b/arch/parisc/include/asm/mman.h | |||
@@ -22,6 +22,8 @@ | |||
22 | #define MAP_GROWSDOWN 0x8000 /* stack-like segment */ | 22 | #define MAP_GROWSDOWN 0x8000 /* stack-like segment */ |
23 | #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ | 23 | #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ |
24 | #define MAP_NONBLOCK 0x20000 /* do not block on IO */ | 24 | #define MAP_NONBLOCK 0x20000 /* do not block on IO */ |
25 | #define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */ | ||
26 | #define MAP_HUGETLB 0x80000 /* create a huge page mapping */ | ||
25 | 27 | ||
26 | #define MS_SYNC 1 /* synchronous memory sync */ | 28 | #define MS_SYNC 1 /* synchronous memory sync */ |
27 | #define MS_ASYNC 2 /* sync memory asynchronously */ | 29 | #define MS_ASYNC 2 /* sync memory asynchronously */ |
diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h index 7b1c49811a24..d4a7f645c5db 100644 --- a/arch/powerpc/include/asm/mman.h +++ b/arch/powerpc/include/asm/mman.h | |||
@@ -25,6 +25,8 @@ | |||
25 | 25 | ||
26 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | 26 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
27 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 27 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
28 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
29 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
28 | 30 | ||
29 | #ifdef __KERNEL__ | 31 | #ifdef __KERNEL__ |
30 | #ifdef CONFIG_PPC64 | 32 | #ifdef CONFIG_PPC64 |
diff --git a/arch/s390/include/asm/mman.h b/arch/s390/include/asm/mman.h index f63fe7b431ed..22714ca181ad 100644 --- a/arch/s390/include/asm/mman.h +++ b/arch/s390/include/asm/mman.h | |||
@@ -18,6 +18,8 @@ | |||
18 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | 18 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
19 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | 19 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
20 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 20 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
21 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
22 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
21 | 23 | ||
22 | #define MCL_CURRENT 1 /* lock all current mappings */ | 24 | #define MCL_CURRENT 1 /* lock all current mappings */ |
23 | #define MCL_FUTURE 2 /* lock all future mappings */ | 25 | #define MCL_FUTURE 2 /* lock all future mappings */ |
diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h index 988192e8e956..c3029ad6619a 100644 --- a/arch/sparc/include/asm/mman.h +++ b/arch/sparc/include/asm/mman.h | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | 21 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
22 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 22 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
23 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | ||
24 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
23 | 25 | ||
24 | #ifdef __KERNEL__ | 26 | #ifdef __KERNEL__ |
25 | #ifndef __ASSEMBLY__ | 27 | #ifndef __ASSEMBLY__ |
diff --git a/arch/xtensa/include/asm/mman.h b/arch/xtensa/include/asm/mman.h index 6e55b4d1f9c5..fca4db425f6e 100644 --- a/arch/xtensa/include/asm/mman.h +++ b/arch/xtensa/include/asm/mman.h | |||
@@ -53,6 +53,8 @@ | |||
53 | #define MAP_LOCKED 0x8000 /* pages are locked */ | 53 | #define MAP_LOCKED 0x8000 /* pages are locked */ |
54 | #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ | 54 | #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ |
55 | #define MAP_NONBLOCK 0x20000 /* do not block on IO */ | 55 | #define MAP_NONBLOCK 0x20000 /* do not block on IO */ |
56 | #define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */ | ||
57 | #define MAP_HUGETLB 0x80000 /* create a huge page mapping */ | ||
56 | 58 | ||
57 | /* | 59 | /* |
58 | * Flags for msync | 60 | * Flags for msync |
diff --git a/include/asm-generic/mman.h b/include/asm-generic/mman.h index 7cab4de2bca6..32c8bd6a196d 100644 --- a/include/asm-generic/mman.h +++ b/include/asm-generic/mman.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | 12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
13 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ | 13 | #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ |
14 | #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ | ||
14 | 15 | ||
15 | #define MCL_CURRENT 1 /* lock all current mappings */ | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
16 | #define MCL_FUTURE 2 /* lock all future mappings */ | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |