mm: introduce vma_init()
Subsystems (4)
[email protected]
maintainerPATCH 6/11 mm: introduce vma_init()
From: "Kirill A. Shutemov" <[email protected]>
Subject: mm: introduce vma_init()
Not all VMAs allocated with vm_area_alloc(). Some of them allocated on stack or in data segment.
The new helper can be use to initialize VMA properly regardless where it was allocated.
Signed-off-by Kirill A. Shutemov <[email protected]>
Acked-by Linus Torvalds <[email protected]>
Reviewed-by Andrew Morton <[email protected]>
Cc Dmitry Vyukov <[email protected]>
Cc Oleg Nesterov <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
include/linux/mm.h | 6 ++++++ kernel/fork.c | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-introduce-vma_init +6 -0
@@ -452,6 +452,12 @@ struct vm_operations_struct { unsigned long addr); }; +static inline void vma_init (struct vm_area_struct *vma,struct mm_struct *mm) +{ + vma->vm_mm = mm; +INIT_LIST_HEAD (&vma->anon_vma_chain); +} +struct mmu_gather ;struct inode ;
kernel/fork.c renamed from kernel/fork.c~mm-introduce-vma_init +2 -4
@@ -312,10 +312,8 @@ struct vm_area_struct *vm_area_alloc(str {struct vm_area_struct *vma =kmem_cache_zalloc (vm_area_cachep,GFP_KERNEL ); -if (vma) { - vma->vm_mm = mm; -INIT_LIST_HEAD (&vma->anon_vma_chain); - } +if (vma) +vma_init (vma, mm);return vma; }
_