提交 26ba0cb6 编写于 作者: A Andrea Arcangeli 提交者: Linus Torvalds

rmap: 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: NAndrea Arcangeli <aarcange@redhat.com>
Signed-off-by: NRik van Riel <riel@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 5e549e98
...@@ -147,7 +147,7 @@ int anon_vma_prepare(struct vm_area_struct *vma) ...@@ -147,7 +147,7 @@ int anon_vma_prepare(struct vm_area_struct *vma)
avc->anon_vma = anon_vma; avc->anon_vma = anon_vma;
avc->vma = vma; avc->vma = vma;
list_add(&avc->same_vma, &vma->anon_vma_chain); 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; allocated = NULL;
avc = NULL; avc = NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册