aboutsummaryrefslogtreecommitdiffstats
path: root/mm/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'mm/internal.h')
-rw-r--r--mm/internal.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/mm/internal.h b/mm/internal.h
index ed8b5ffcf9b1..a38a21ebddb4 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -216,6 +216,37 @@ 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 */
226static inline bool is_exec_mapping(vm_flags_t flags)
227{
228 return (flags & (VM_EXEC | VM_WRITE | VM_STACK)) == VM_EXEC;
229}
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 */
237static inline bool is_stack_mapping(vm_flags_t flags)
238{
239 return (flags & VM_STACK) == VM_STACK;
240}
241
242/*
243 * Data area - private, writable, not stack
244 */
245static inline bool is_data_mapping(vm_flags_t flags)
246{
247 return (flags & (VM_WRITE | VM_SHARED | VM_STACK)) == VM_WRITE;
248}
249
219/* mm/util.c */ 250/* mm/util.c */
220void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma, 251void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
221 struct vm_area_struct *prev, struct rb_node *rb_parent); 252 struct vm_area_struct *prev, struct rb_node *rb_parent);