Commit e6ac361f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] mpol in copy_vma

From: Hugh Dickins <hugh@veritas.com>

I think Andi missed the copy_vma I recently added for mremap, and it'll
need something like below....  (Doesn't look like it'll optimize away when
it's not needed - rather bloaty.)
parent d3b8924a
...@@ -1504,6 +1504,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, ...@@ -1504,6 +1504,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
struct mm_struct *mm = vma->vm_mm; struct mm_struct *mm = vma->vm_mm;
struct vm_area_struct *new_vma, *prev; struct vm_area_struct *new_vma, *prev;
struct rb_node **rb_link, *rb_parent; struct rb_node **rb_link, *rb_parent;
struct mempolicy *pol;
find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent); find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent);
new_vma = vma_merge(mm, prev, rb_parent, addr, addr + len, new_vma = vma_merge(mm, prev, rb_parent, addr, addr + len,
...@@ -1519,6 +1520,12 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, ...@@ -1519,6 +1520,12 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
new_vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); new_vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
if (new_vma) { if (new_vma) {
*new_vma = *vma; *new_vma = *vma;
pol = mpol_copy(vma_policy(vma));
if (IS_ERR(pol)) {
kmem_cache_free(vm_area_cachep, new_vma);
return NULL;
}
vma_set_policy(new_vma, pol);
INIT_LIST_HEAD(&new_vma->shared); INIT_LIST_HEAD(&new_vma->shared);
new_vma->vm_start = addr; new_vma->vm_start = addr;
new_vma->vm_end = addr + len; new_vma->vm_end = addr + len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment