Re: [PATCH -v2] rmap: make anon_vma_prepare link in all the anon_vmasof a mergeable VMA

From: Rik van Riel
Date: Fri Apr 09 2010 - 20:20:29 EST


On 04/09/2010 07:56 PM, Linus Torvalds wrote:

So _instead_ of all the patches that have floated about, I would suggest
this simple change to "find_mergeable_anon_vma()" instead..

Boris, this is your chance to really ruin our week :)

If the bug persists with Linus's patch, we've been fixing
the wrong bug all week long, and you are experiencing
something else...

I'm getting really curious now.

---
mm/mmap.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 75557c6..462a8ca 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -850,7 +850,8 @@ struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *vma)
vm_flags = vma->vm_flags& ~(VM_READ|VM_WRITE|VM_EXEC);
vm_flags |= near->vm_flags& (VM_READ|VM_WRITE|VM_EXEC);

- if (near->anon_vma&& vma->vm_end == near->vm_start&&
+ if (near->anon_vma&& list_is_singular(&near->anon_vma_chain)&&
+ vma->vm_end == near->vm_start&&
mpol_equal(vma_policy(vma), vma_policy(near))&&
can_vma_merge_before(near, vm_flags,
NULL, vma->vm_file, vma->vm_pgoff +
@@ -871,7 +872,8 @@ try_prev:
vm_flags = vma->vm_flags& ~(VM_READ|VM_WRITE|VM_EXEC);
vm_flags |= near->vm_flags& (VM_READ|VM_WRITE|VM_EXEC);

- if (near->anon_vma&& near->vm_end == vma->vm_start&&
+ if (near->anon_vma&& list_is_singular(&near->anon_vma_chain)&&
+ near->vm_end == vma->vm_start&&
mpol_equal(vma_policy(near), vma_policy(vma))&&
can_vma_merge_after(near, vm_flags,
NULL, vma->vm_file, vma->vm_pgoff))

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/