Prev: [PATCH -mm 1/6] mmap: remove unnecessary lock from __vma_link
Next: [PATCH 0/6] further anon_vma fixes & optimizations
From: Rik van Riel on 21 Jun 2010 16:50 From: Andrea Arcangeli <aarcange(a)redhat.com> Subject: always add new vmas at the end Make sure to always add new VMAs at the end of the list. This is important so rmap_walk does not miss a VMA that was created during the rmap_walk. The old code got this right most of the time due to luck, but was buggy when anon_vma_prepare reused a mergeable anon_vma. Signed-off-by: Andrea Arcangeli <aarcange(a)redhat.com> Signed-off-by: Rik van Riel <riel(a)redhat.com> --- diff --git a/mm/rmap.c b/mm/rmap.c --- a/mm/rmap.c +++ b/mm/rmap.c @@ -149,7 +149,7 @@ int anon_vma_prepare(struct vm_area_stru avc->anon_vma = anon_vma; avc->vma = vma; list_add(&avc->same_vma, &vma->anon_vma_chain); - list_add(&avc->same_anon_vma, &anon_vma->head); + list_add_tail(&avc->same_anon_vma, &anon_vma->head); allocated = NULL; avc = NULL; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |