Skip to contentSkip to conversation

mpol in copy_vma

PATCH In review [email protected] 2 participants 2 messages May 22, 2004 – May 23, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 21/57 mpol in copy_vma

From: Hugh Dickins <[email protected]>

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.)

---

 25-akpm/mm/mmap.c |    7 +++++++
 1 files changed, 7 insertions(+)
mm/mmap.c renamed from mm/mmap.c~mpol-in-copy_vma +7 -0
diff -puN mm/mmap.c~mpol-in-copy_vma mm/mmap.c
@@ -1504,6 +1504,7 @@ struct vm_area_struct *copy_vma(struct v
 	struct mm_struct *mm = vma->vm_mm;
 	struct vm_area_struct *new_vma, *prev;
 	struct rb_node **rb_link, *rb_parent;
+	struct mempolicy *pol;
 
 	find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent);
 	new_vma = vma_merge(mm, prev, rb_parent, addr, addr + len,
@@ -1519,6 +1520,12 @@ struct vm_area_struct *copy_vma(struct v
 		new_vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
 		if (new_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);
 			new_vma->vm_start = addr;
 			new_vma->vm_end = addr + len;

_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 6 lines · On Sat, 22 May 2004 [email protected] wrote:

From: Hugh Dickins <[email protected]>

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.)

It did optimize away - that comment slandered Andi's work - I apologize!

Hugh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>