diff options
author | Konstantin Khlebnikov <khlebnikov@openvz.org> | 2012-10-08 19:28:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-09 03:22:16 -0400 |
commit | cc2383ec06be093789469852e1fe96e1148e9a2c (patch) | |
tree | ea65c486104507000cdc5c2957015f2895dda7a2 | |
parent | b3b9c2932c32e0692018ed5f12f3fd8c70eea8ce (diff) |
mm: introduce arch-specific vma flag VM_ARCH_1
Combine several arch-specific vma flags into one.
before patch:
0x00000200 0x01000000 0x20000000 0x40000000
x86 VM_NOHUGEPAGE VM_HUGEPAGE - VM_PAT
powerpc - - VM_SAO -
parisc VM_GROWSUP - - -
ia64 VM_GROWSUP - - -
nommu - VM_MAPPED_COPY - -
others - - - -
after patch:
0x00000200 0x01000000 0x20000000 0x40000000
x86 - VM_PAT VM_HUGEPAGE VM_NOHUGEPAGE
powerpc - VM_SAO - -
parisc - VM_GROWSUP - -
ia64 - VM_GROWSUP - -
nommu - VM_MAPPED_COPY - -
others - VM_ARCH_1 - -
And voila! One completely free bit.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Carsten Otte <cotte@de.ibm.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Eric Paris <eparis@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Venkatesh Pallipadi <venki@google.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/mm.h | 34 | ||||
-rw-r--r-- | mm/huge_memory.c | 2 | ||||
-rw-r--r-- | mm/ksm.c | 7 |
3 files changed, 28 insertions, 15 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 75d1632d3477..9c039f84b63c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -70,6 +70,8 @@ extern unsigned int kobjsize(const void *objp); | |||
70 | /* | 70 | /* |
71 | * vm_flags in vm_area_struct, see mm_types.h. | 71 | * vm_flags in vm_area_struct, see mm_types.h. |
72 | */ | 72 | */ |
73 | #define VM_NONE 0x00000000 | ||
74 | |||
73 | #define VM_READ 0x00000001 /* currently active flags */ | 75 | #define VM_READ 0x00000001 /* currently active flags */ |
74 | #define VM_WRITE 0x00000002 | 76 | #define VM_WRITE 0x00000002 |
75 | #define VM_EXEC 0x00000004 | 77 | #define VM_EXEC 0x00000004 |
@@ -82,12 +84,6 @@ extern unsigned int kobjsize(const void *objp); | |||
82 | #define VM_MAYSHARE 0x00000080 | 84 | #define VM_MAYSHARE 0x00000080 |
83 | 85 | ||
84 | #define VM_GROWSDOWN 0x00000100 /* general info on the segment */ | 86 | #define VM_GROWSDOWN 0x00000100 /* general info on the segment */ |
85 | #if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64) | ||
86 | #define VM_GROWSUP 0x00000200 | ||
87 | #else | ||
88 | #define VM_GROWSUP 0x00000000 | ||
89 | #define VM_NOHUGEPAGE 0x00000200 /* MADV_NOHUGEPAGE marked this vma */ | ||
90 | #endif | ||
91 | #define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ | 87 | #define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ |
92 | #define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ | 88 | #define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ |
93 | 89 | ||
@@ -106,20 +102,32 @@ extern unsigned int kobjsize(const void *objp); | |||
106 | #define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */ | 102 | #define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */ |
107 | #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ | 103 | #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ |
108 | #define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ | 104 | #define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ |
109 | #ifndef CONFIG_TRANSPARENT_HUGEPAGE | 105 | #define VM_ARCH_1 0x01000000 /* Architecture-specific flag */ |
110 | #define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ | ||
111 | #else | ||
112 | #define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */ | ||
113 | #endif | ||
114 | #define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ | 106 | #define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ |
115 | #define VM_NODUMP 0x04000000 /* Do not include in the core dump */ | 107 | #define VM_NODUMP 0x04000000 /* Do not include in the core dump */ |
116 | 108 | ||
117 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ | 109 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ |
118 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ | 110 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ |
119 | #define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ | 111 | #define VM_HUGEPAGE 0x20000000 /* MADV_HUGEPAGE marked this vma */ |
120 | #define VM_PAT 0x40000000 /* PAT reserves whole VMA at once (x86) */ | 112 | #define VM_NOHUGEPAGE 0x40000000 /* MADV_NOHUGEPAGE marked this vma */ |
121 | #define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */ | 113 | #define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */ |
122 | 114 | ||
115 | #if defined(CONFIG_X86) | ||
116 | # define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ | ||
117 | #elif defined(CONFIG_PPC) | ||
118 | # define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */ | ||
119 | #elif defined(CONFIG_PARISC) | ||
120 | # define VM_GROWSUP VM_ARCH_1 | ||
121 | #elif defined(CONFIG_IA64) | ||
122 | # define VM_GROWSUP VM_ARCH_1 | ||
123 | #elif !defined(CONFIG_MMU) | ||
124 | # define VM_MAPPED_COPY VM_ARCH_1 /* T if mapped copy of data (nommu mmap) */ | ||
125 | #endif | ||
126 | |||
127 | #ifndef VM_GROWSUP | ||
128 | # define VM_GROWSUP VM_NONE | ||
129 | #endif | ||
130 | |||
123 | /* Bits set in the VMA until the stack is in its final location */ | 131 | /* Bits set in the VMA until the stack is in its final location */ |
124 | #define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ) | 132 | #define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ) |
125 | 133 | ||
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 73cb22ee9665..47206692cf88 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1491,7 +1491,7 @@ out: | |||
1491 | return ret; | 1491 | return ret; |
1492 | } | 1492 | } |
1493 | 1493 | ||
1494 | #define VM_NO_THP (VM_SPECIAL|VM_INSERTPAGE|VM_MIXEDMAP|VM_SAO| \ | 1494 | #define VM_NO_THP (VM_SPECIAL|VM_INSERTPAGE|VM_MIXEDMAP| \ |
1495 | VM_HUGETLB|VM_SHARED|VM_MAYSHARE) | 1495 | VM_HUGETLB|VM_SHARED|VM_MAYSHARE) |
1496 | 1496 | ||
1497 | int hugepage_madvise(struct vm_area_struct *vma, | 1497 | int hugepage_madvise(struct vm_area_struct *vma, |
@@ -1470,9 +1470,14 @@ int ksm_madvise(struct vm_area_struct *vma, unsigned long start, | |||
1470 | if (*vm_flags & (VM_MERGEABLE | VM_SHARED | VM_MAYSHARE | | 1470 | if (*vm_flags & (VM_MERGEABLE | VM_SHARED | VM_MAYSHARE | |
1471 | VM_PFNMAP | VM_IO | VM_DONTEXPAND | | 1471 | VM_PFNMAP | VM_IO | VM_DONTEXPAND | |
1472 | VM_RESERVED | VM_HUGETLB | VM_INSERTPAGE | | 1472 | VM_RESERVED | VM_HUGETLB | VM_INSERTPAGE | |
1473 | VM_NONLINEAR | VM_MIXEDMAP | VM_SAO)) | 1473 | VM_NONLINEAR | VM_MIXEDMAP)) |
1474 | return 0; /* just ignore the advice */ | 1474 | return 0; /* just ignore the advice */ |
1475 | 1475 | ||
1476 | #ifdef VM_SAO | ||
1477 | if (*vm_flags & VM_SAO) | ||
1478 | return 0; | ||
1479 | #endif | ||
1480 | |||
1476 | if (!test_bit(MMF_VM_MERGEABLE, &mm->flags)) { | 1481 | if (!test_bit(MMF_VM_MERGEABLE, &mm->flags)) { |
1477 | err = __ksm_enter(mm); | 1482 | err = __ksm_enter(mm); |
1478 | if (err) | 1483 | if (err) |