Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: make vm_area_alloc() initialize core fields

Like vm_area_dup(), it initializes the anon_vma_chain head, and the
basic mm pointer.

The rest of the fields end up being different for different users,
although the plan is to also initialize the 'vm_ops' field to a dummy
entry.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+17 -26
+1 -3
arch/ia64/kernel/perfmon.c
··· 2278 2278 DPRINT(("smpl_buf @%p\n", smpl_buf)); 2279 2279 2280 2280 /* allocate vma */ 2281 - vma = vm_area_alloc(); 2281 + vma = vm_area_alloc(mm); 2282 2282 if (!vma) { 2283 2283 DPRINT(("Cannot allocate vma\n")); 2284 2284 goto error_kmem; 2285 2285 } 2286 - INIT_LIST_HEAD(&vma->anon_vma_chain); 2287 2286 2288 2287 /* 2289 2288 * partially initialize the vma for the sampling buffer 2290 2289 */ 2291 - vma->vm_mm = mm; 2292 2290 vma->vm_file = get_file(filp); 2293 2291 vma->vm_flags = VM_READ|VM_MAYREAD|VM_DONTEXPAND|VM_DONTDUMP; 2294 2292 vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */
+2 -6
arch/ia64/mm/init.c
··· 114 114 * the problem. When the process attempts to write to the register backing store 115 115 * for the first time, it will get a SEGFAULT in this case. 116 116 */ 117 - vma = vm_area_alloc(); 117 + vma = vm_area_alloc(current->mm); 118 118 if (vma) { 119 - INIT_LIST_HEAD(&vma->anon_vma_chain); 120 - vma->vm_mm = current->mm; 121 119 vma->vm_start = current->thread.rbs_bot & PAGE_MASK; 122 120 vma->vm_end = vma->vm_start + PAGE_SIZE; 123 121 vma->vm_flags = VM_DATA_DEFAULT_FLAGS|VM_GROWSUP|VM_ACCOUNT; ··· 131 133 132 134 /* map NaT-page at address zero to speed up speculative dereferencing of NULL: */ 133 135 if (!(current->personality & MMAP_PAGE_ZERO)) { 134 - vma = vm_area_alloc(); 136 + vma = vm_area_alloc(current->mm); 135 137 if (vma) { 136 - INIT_LIST_HEAD(&vma->anon_vma_chain); 137 - vma->vm_mm = current->mm; 138 138 vma->vm_end = PAGE_SIZE; 139 139 vma->vm_page_prot = __pgprot(pgprot_val(PAGE_READONLY) | _PAGE_MA_NAT); 140 140 vma->vm_flags = VM_READ | VM_MAYREAD | VM_IO |
+1 -3
fs/exec.c
··· 290 290 struct vm_area_struct *vma = NULL; 291 291 struct mm_struct *mm = bprm->mm; 292 292 293 - bprm->vma = vma = vm_area_alloc(); 293 + bprm->vma = vma = vm_area_alloc(mm); 294 294 if (!vma) 295 295 return -ENOMEM; 296 296 ··· 298 298 err = -EINTR; 299 299 goto err_free; 300 300 } 301 - vma->vm_mm = mm; 302 301 303 302 /* 304 303 * Place the stack at the largest stack address the architecture ··· 310 311 vma->vm_start = vma->vm_end - PAGE_SIZE; 311 312 vma->vm_flags = VM_SOFTDIRTY | VM_STACK_FLAGS | VM_STACK_INCOMPLETE_SETUP; 312 313 vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); 313 - INIT_LIST_HEAD(&vma->anon_vma_chain); 314 314 315 315 err = insert_vm_struct(mm, vma); 316 316 if (err)
+1 -1
include/linux/mm.h
··· 155 155 * mmap() functions). 156 156 */ 157 157 158 - struct vm_area_struct *vm_area_alloc(void); 158 + struct vm_area_struct *vm_area_alloc(struct mm_struct *); 159 159 struct vm_area_struct *vm_area_dup(struct vm_area_struct *); 160 160 void vm_area_free(struct vm_area_struct *); 161 161
+8 -2
kernel/fork.c
··· 308 308 /* SLAB cache for mm_struct structures (tsk->mm) */ 309 309 static struct kmem_cache *mm_cachep; 310 310 311 - struct vm_area_struct *vm_area_alloc(void) 311 + struct vm_area_struct *vm_area_alloc(struct mm_struct *mm) 312 312 { 313 - return kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); 313 + struct vm_area_struct *vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); 314 + 315 + if (vma) { 316 + vma->vm_mm = mm; 317 + INIT_LIST_HEAD(&vma->anon_vma_chain); 318 + } 319 + return vma; 314 320 } 315 321 316 322 struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig)
+3 -9
mm/mmap.c
··· 1729 1729 * specific mapper. the address has already been validated, but 1730 1730 * not unmapped, but the maps are removed from the list. 1731 1731 */ 1732 - vma = vm_area_alloc(); 1732 + vma = vm_area_alloc(mm); 1733 1733 if (!vma) { 1734 1734 error = -ENOMEM; 1735 1735 goto unacct_error; 1736 1736 } 1737 1737 1738 - vma->vm_mm = mm; 1739 1738 vma->vm_start = addr; 1740 1739 vma->vm_end = addr + len; 1741 1740 vma->vm_flags = vm_flags; 1742 1741 vma->vm_page_prot = vm_get_page_prot(vm_flags); 1743 1742 vma->vm_pgoff = pgoff; 1744 - INIT_LIST_HEAD(&vma->anon_vma_chain); 1745 1743 1746 1744 if (file) { 1747 1745 if (vm_flags & VM_DENYWRITE) { ··· 2977 2979 /* 2978 2980 * create a vma struct for an anonymous mapping 2979 2981 */ 2980 - vma = vm_area_alloc(); 2982 + vma = vm_area_alloc(mm); 2981 2983 if (!vma) { 2982 2984 vm_unacct_memory(len >> PAGE_SHIFT); 2983 2985 return -ENOMEM; 2984 2986 } 2985 2987 2986 - INIT_LIST_HEAD(&vma->anon_vma_chain); 2987 - vma->vm_mm = mm; 2988 2988 vma->vm_start = addr; 2989 2989 vma->vm_end = addr + len; 2990 2990 vma->vm_pgoff = pgoff; ··· 3339 3343 int ret; 3340 3344 struct vm_area_struct *vma; 3341 3345 3342 - vma = vm_area_alloc(); 3346 + vma = vm_area_alloc(mm); 3343 3347 if (unlikely(vma == NULL)) 3344 3348 return ERR_PTR(-ENOMEM); 3345 3349 3346 - INIT_LIST_HEAD(&vma->anon_vma_chain); 3347 - vma->vm_mm = mm; 3348 3350 vma->vm_start = addr; 3349 3351 vma->vm_end = addr + len; 3350 3352
+1 -2
mm/nommu.c
··· 1204 1204 if (!region) 1205 1205 goto error_getting_region; 1206 1206 1207 - vma = vm_area_alloc(); 1207 + vma = vm_area_alloc(current->mm); 1208 1208 if (!vma) 1209 1209 goto error_getting_vma; 1210 1210 ··· 1212 1212 region->vm_flags = vm_flags; 1213 1213 region->vm_pgoff = pgoff; 1214 1214 1215 - INIT_LIST_HEAD(&vma->anon_vma_chain); 1216 1215 vma->vm_flags = vm_flags; 1217 1216 vma->vm_pgoff = pgoff; 1218 1217