diff options
-rw-r--r-- | Documentation/filesystems/proc.txt | 4 | ||||
-rw-r--r-- | include/linux/mm.h | 6 | ||||
-rw-r--r-- | include/linux/mm_types.h | 6 | ||||
-rw-r--r-- | mm/internal.h | 23 |
4 files changed, 28 insertions, 11 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index eaebf27539f5..843b045b4069 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -240,8 +240,8 @@ Table 1-2: Contents of the status files (as of 4.1) | |||
240 | RssFile size of resident file mappings | 240 | RssFile size of resident file mappings |
241 | RssShmem size of resident shmem memory (includes SysV shm, | 241 | RssShmem size of resident shmem memory (includes SysV shm, |
242 | mapping of tmpfs and shared anonymous mappings) | 242 | mapping of tmpfs and shared anonymous mappings) |
243 | VmData size of data, stack, and text segments | 243 | VmData size of private data segments |
244 | VmStk size of data, stack, and text segments | 244 | VmStk size of stack segments |
245 | VmExe size of text segment | 245 | VmExe size of text segment |
246 | VmLib size of shared library code | 246 | VmLib size of shared library code |
247 | VmPTE size of page table entries | 247 | VmPTE size of page table entries |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 0b50d7848e3a..516e14944339 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -201,11 +201,13 @@ extern unsigned int kobjsize(const void *objp); | |||
201 | #endif | 201 | #endif |
202 | 202 | ||
203 | #ifdef CONFIG_STACK_GROWSUP | 203 | #ifdef CONFIG_STACK_GROWSUP |
204 | #define VM_STACK_FLAGS (VM_GROWSUP | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT) | 204 | #define VM_STACK VM_GROWSUP |
205 | #else | 205 | #else |
206 | #define VM_STACK_FLAGS (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT) | 206 | #define VM_STACK VM_GROWSDOWN |
207 | #endif | 207 | #endif |
208 | 208 | ||
209 | #define VM_STACK_FLAGS (VM_STACK | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT) | ||
210 | |||
209 | /* | 211 | /* |
210 | * Special vmas that are non-mergable, non-mlock()able. | 212 | * Special vmas that are non-mergable, non-mlock()able. |
211 | * Note: mm/huge_memory.c VM_NO_THP depends on this definition. | 213 | * Note: mm/huge_memory.c VM_NO_THP depends on this definition. |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index d3ebb9d21a53..624b78b848b8 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -424,9 +424,9 @@ struct mm_struct { | |||
424 | unsigned long total_vm; /* Total pages mapped */ | 424 | unsigned long total_vm; /* Total pages mapped */ |
425 | unsigned long locked_vm; /* Pages that have PG_mlocked set */ | 425 | unsigned long locked_vm; /* Pages that have PG_mlocked set */ |
426 | unsigned long pinned_vm; /* Refcount permanently increased */ | 426 | unsigned long pinned_vm; /* Refcount permanently increased */ |
427 | unsigned long data_vm; /* VM_WRITE & ~VM_SHARED/GROWSDOWN */ | 427 | unsigned long data_vm; /* VM_WRITE & ~VM_SHARED & ~VM_STACK */ |
428 | unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE */ | 428 | unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE & ~VM_STACK */ |
429 | unsigned long stack_vm; /* VM_GROWSUP/DOWN */ | 429 | unsigned long stack_vm; /* VM_STACK */ |
430 | unsigned long def_flags; | 430 | unsigned long def_flags; |
431 | unsigned long start_code, end_code, start_data, end_data; | 431 | unsigned long start_code, end_code, start_data, end_data; |
432 | unsigned long start_brk, brk, start_stack; | 432 | unsigned long start_brk, brk, start_stack; |
diff --git a/mm/internal.h b/mm/internal.h index 6e976302ddd8..a38a21ebddb4 100644 --- a/mm/internal.h +++ b/mm/internal.h | |||
@@ -216,20 +216,35 @@ static inline bool is_cow_mapping(vm_flags_t flags) | |||
216 | return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE; | 216 | return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE; |
217 | } | 217 | } |
218 | 218 | ||
219 | /* | ||
220 | * These three helpers classifies VMAs for virtual memory accounting. | ||
221 | */ | ||
222 | |||
223 | /* | ||
224 | * Executable code area - executable, not writable, not stack | ||
225 | */ | ||
219 | static inline bool is_exec_mapping(vm_flags_t flags) | 226 | static inline bool is_exec_mapping(vm_flags_t flags) |
220 | { | 227 | { |
221 | return (flags & (VM_EXEC | VM_WRITE)) == VM_EXEC; | 228 | return (flags & (VM_EXEC | VM_WRITE | VM_STACK)) == VM_EXEC; |
222 | } | 229 | } |
223 | 230 | ||
231 | /* | ||
232 | * Stack area - atomatically grows in one direction | ||
233 | * | ||
234 | * VM_GROWSUP / VM_GROWSDOWN VMAs are always private anonymous: | ||
235 | * do_mmap() forbids all other combinations. | ||
236 | */ | ||
224 | static inline bool is_stack_mapping(vm_flags_t flags) | 237 | static inline bool is_stack_mapping(vm_flags_t flags) |
225 | { | 238 | { |
226 | return (flags & (VM_STACK_FLAGS & (VM_GROWSUP | VM_GROWSDOWN))) != 0; | 239 | return (flags & VM_STACK) == VM_STACK; |
227 | } | 240 | } |
228 | 241 | ||
242 | /* | ||
243 | * Data area - private, writable, not stack | ||
244 | */ | ||
229 | static inline bool is_data_mapping(vm_flags_t flags) | 245 | static inline bool is_data_mapping(vm_flags_t flags) |
230 | { | 246 | { |
231 | return (flags & ((VM_STACK_FLAGS & (VM_GROWSUP | VM_GROWSDOWN)) | | 247 | return (flags & (VM_WRITE | VM_SHARED | VM_STACK)) == VM_WRITE; |
232 | VM_WRITE | VM_SHARED)) == VM_WRITE; | ||
233 | } | 248 | } |
234 | 249 | ||
235 | /* mm/util.c */ | 250 | /* mm/util.c */ |