Commit 90f72aa58bbf076b68e289fbd71eb829bc505923
Committed by
Linus Torvalds
1 parent
6bfde05bf5
Exists in
master
and in
39 other branches
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>
Showing 17 changed files with 33 additions and 0 deletions Side-by-side Diff
- 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
arch/alpha/include/asm/mman.h
... | ... | @@ -28,6 +28,8 @@ |
28 | 28 | #define MAP_NORESERVE 0x10000 /* don't check for reservations */ |
29 | 29 | #define MAP_POPULATE 0x20000 /* populate (prefault) pagetables */ |
30 | 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 | 34 | #define MS_ASYNC 1 /* sync memory asynchronously */ |
33 | 35 | #define MS_SYNC 2 /* synchronous memory sync */ |
arch/arm/include/asm/mman.h
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) page tables */ |
12 | 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 | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
arch/avr32/include/asm/mman.h
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) page tables */ |
12 | 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 | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
arch/cris/include/asm/mman.h
... | ... | @@ -12,6 +12,8 @@ |
12 | 12 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
13 | 13 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
14 | 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 | 18 | #define MCL_CURRENT 1 /* lock all current mappings */ |
17 | 19 | #define MCL_FUTURE 2 /* lock all future mappings */ |
arch/frv/include/asm/mman.h
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
12 | 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 | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
arch/h8300/include/asm/mman.h
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
12 | 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 | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
arch/ia64/include/asm/mman.h
... | ... | @@ -18,6 +18,8 @@ |
18 | 18 | #define MAP_NORESERVE 0x04000 /* don't check for reservations */ |
19 | 19 | #define MAP_POPULATE 0x08000 /* populate (prefault) pagetables */ |
20 | 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 | 24 | #define MCL_CURRENT 1 /* lock all current mappings */ |
23 | 25 | #define MCL_FUTURE 2 /* lock all future mappings */ |
arch/m32r/include/asm/mman.h
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
12 | 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 | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
arch/m68k/include/asm/mman.h
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
11 | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
12 | 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 | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
15 | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |
arch/mips/include/asm/mman.h
... | ... | @@ -46,6 +46,8 @@ |
46 | 46 | #define MAP_LOCKED 0x8000 /* pages are locked */ |
47 | 47 | #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ |
48 | 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 | 53 | * Flags for msync |
arch/mn10300/include/asm/mman.h
... | ... | @@ -21,6 +21,8 @@ |
21 | 21 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
22 | 22 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
23 | 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 | 27 | #define MCL_CURRENT 1 /* lock all current mappings */ |
26 | 28 | #define MCL_FUTURE 2 /* lock all future mappings */ |
arch/parisc/include/asm/mman.h
... | ... | @@ -22,6 +22,8 @@ |
22 | 22 | #define MAP_GROWSDOWN 0x8000 /* stack-like segment */ |
23 | 23 | #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ |
24 | 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 | 28 | #define MS_SYNC 1 /* synchronous memory sync */ |
27 | 29 | #define MS_ASYNC 2 /* sync memory asynchronously */ |
arch/powerpc/include/asm/mman.h
... | ... | @@ -25,6 +25,8 @@ |
25 | 25 | |
26 | 26 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
27 | 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 | 31 | #ifdef __KERNEL__ |
30 | 32 | #ifdef CONFIG_PPC64 |
arch/s390/include/asm/mman.h
... | ... | @@ -18,6 +18,8 @@ |
18 | 18 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ |
19 | 19 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
20 | 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 | 24 | #define MCL_CURRENT 1 /* lock all current mappings */ |
23 | 25 | #define MCL_FUTURE 2 /* lock all future mappings */ |
arch/sparc/include/asm/mman.h
... | ... | @@ -20,6 +20,8 @@ |
20 | 20 | |
21 | 21 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
22 | 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 | 26 | #ifdef __KERNEL__ |
25 | 27 | #ifndef __ASSEMBLY__ |
arch/xtensa/include/asm/mman.h
... | ... | @@ -53,6 +53,8 @@ |
53 | 53 | #define MAP_LOCKED 0x8000 /* pages are locked */ |
54 | 54 | #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ |
55 | 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 | 60 | * Flags for msync |
include/asm-generic/mman.h
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
12 | 12 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ |
13 | 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 | 16 | #define MCL_CURRENT 1 /* lock all current mappings */ |
16 | 17 | #define MCL_FUTURE 2 /* lock all future mappings */ |