|
@@ -182,7 +182,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
|
|
if (vma->vm_file)
|
|
if (vma->vm_file)
|
|
fput(vma->vm_file);
|
|
fput(vma->vm_file);
|
|
mpol_put(vma_policy(vma));
|
|
mpol_put(vma_policy(vma));
|
|
- kmem_cache_free(vm_area_cachep, vma);
|
|
|
|
|
|
+ vm_area_free(vma);
|
|
return next;
|
|
return next;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -911,7 +911,7 @@ again:
|
|
anon_vma_merge(vma, next);
|
|
anon_vma_merge(vma, next);
|
|
mm->map_count--;
|
|
mm->map_count--;
|
|
mpol_put(vma_policy(next));
|
|
mpol_put(vma_policy(next));
|
|
- kmem_cache_free(vm_area_cachep, next);
|
|
|
|
|
|
+ vm_area_free(next);
|
|
/*
|
|
/*
|
|
* In mprotect's case 6 (see comments on vma_merge),
|
|
* In mprotect's case 6 (see comments on vma_merge),
|
|
* we must remove another next too. It would clutter
|
|
* we must remove another next too. It would clutter
|
|
@@ -1729,7 +1729,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
|
|
* specific mapper. the address has already been validated, but
|
|
* specific mapper. the address has already been validated, but
|
|
* not unmapped, but the maps are removed from the list.
|
|
* not unmapped, but the maps are removed from the list.
|
|
*/
|
|
*/
|
|
- vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
|
|
|
|
|
|
+ vma = vm_area_alloc();
|
|
if (!vma) {
|
|
if (!vma) {
|
|
error = -ENOMEM;
|
|
error = -ENOMEM;
|
|
goto unacct_error;
|
|
goto unacct_error;
|
|
@@ -1832,7 +1832,7 @@ allow_write_and_free_vma:
|
|
if (vm_flags & VM_DENYWRITE)
|
|
if (vm_flags & VM_DENYWRITE)
|
|
allow_write_access(file);
|
|
allow_write_access(file);
|
|
free_vma:
|
|
free_vma:
|
|
- kmem_cache_free(vm_area_cachep, vma);
|
|
|
|
|
|
+ vm_area_free(vma);
|
|
unacct_error:
|
|
unacct_error:
|
|
if (charged)
|
|
if (charged)
|
|
vm_unacct_memory(charged);
|
|
vm_unacct_memory(charged);
|
|
@@ -2620,7 +2620,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
|
|
|
|
- new = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
|
|
|
|
|
|
+ new = vm_area_dup(vma);
|
|
if (!new)
|
|
if (!new)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
|
|
|
@@ -2669,7 +2669,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
|
|
out_free_mpol:
|
|
out_free_mpol:
|
|
mpol_put(vma_policy(new));
|
|
mpol_put(vma_policy(new));
|
|
out_free_vma:
|
|
out_free_vma:
|
|
- kmem_cache_free(vm_area_cachep, new);
|
|
|
|
|
|
+ vm_area_free(new);
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2984,7 +2984,7 @@ static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long fla
|
|
/*
|
|
/*
|
|
* create a vma struct for an anonymous mapping
|
|
* create a vma struct for an anonymous mapping
|
|
*/
|
|
*/
|
|
- vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
|
|
|
|
|
|
+ vma = vm_area_alloc();
|
|
if (!vma) {
|
|
if (!vma) {
|
|
vm_unacct_memory(len >> PAGE_SHIFT);
|
|
vm_unacct_memory(len >> PAGE_SHIFT);
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
@@ -3202,7 +3202,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
|
|
}
|
|
}
|
|
*need_rmap_locks = (new_vma->vm_pgoff <= vma->vm_pgoff);
|
|
*need_rmap_locks = (new_vma->vm_pgoff <= vma->vm_pgoff);
|
|
} else {
|
|
} else {
|
|
- new_vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
|
|
|
|
|
|
+ new_vma = vm_area_dup(vma);
|
|
if (!new_vma)
|
|
if (!new_vma)
|
|
goto out;
|
|
goto out;
|
|
*new_vma = *vma;
|
|
*new_vma = *vma;
|
|
@@ -3226,7 +3226,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
|
|
out_free_mempol:
|
|
out_free_mempol:
|
|
mpol_put(vma_policy(new_vma));
|
|
mpol_put(vma_policy(new_vma));
|
|
out_free_vma:
|
|
out_free_vma:
|
|
- kmem_cache_free(vm_area_cachep, new_vma);
|
|
|
|
|
|
+ vm_area_free(new_vma);
|
|
out:
|
|
out:
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
@@ -3350,7 +3350,7 @@ static struct vm_area_struct *__install_special_mapping(
|
|
int ret;
|
|
int ret;
|
|
struct vm_area_struct *vma;
|
|
struct vm_area_struct *vma;
|
|
|
|
|
|
- vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
|
|
|
|
|
|
+ vma = vm_area_alloc();
|
|
if (unlikely(vma == NULL))
|
|
if (unlikely(vma == NULL))
|
|
return ERR_PTR(-ENOMEM);
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
|
|
@@ -3376,7 +3376,7 @@ static struct vm_area_struct *__install_special_mapping(
|
|
return vma;
|
|
return vma;
|
|
|
|
|
|
out:
|
|
out:
|
|
- kmem_cache_free(vm_area_cachep, vma);
|
|
|
|
|
|
+ vm_area_free(vma);
|
|
return ERR_PTR(ret);
|
|
return ERR_PTR(ret);
|
|
}
|
|
}
|
|
|
|
|