* [PATCH] fix rmap walk during fork
@ 2010-09-15 17:16 Andrea Arcangeli
2010-09-15 19:49 ` Hugh Dickins
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andrea Arcangeli @ 2010-09-15 17:16 UTC (permalink / raw)
To: linux-mm; +Cc: Andrew Morton, Johannes Weiner, Rik van Riel, Hugh Dickins
From: Andrea Arcangeli <aarcange@redhat.com>
The below bug in fork lead to the rmap walk finding the parent huge-pmd twice
instead of just one, because the anon_vma_chain objects of the child vma still
point to the vma->vm_mm of the parent. The below patch fixes it by making the
rmap walk accurate during fork. It's not a big deal normally but it
worth being accurate considering the cost is the same.
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---
diff --git a/kernel/fork.c b/kernel/fork.c
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -360,10 +360,10 @@ static int dup_mmap(struct mm_struct *mm
if (IS_ERR(pol))
goto fail_nomem_policy;
vma_set_policy(tmp, pol);
+ tmp->vm_mm = mm;
if (anon_vma_fork(tmp, mpnt))
goto fail_nomem_anon_vma_fork;
tmp->vm_flags &= ~VM_LOCKED;
- tmp->vm_mm = mm;
tmp->vm_next = tmp->vm_prev = NULL;
file = tmp->vm_file;
if (file) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fix rmap walk during fork
2010-09-15 17:16 [PATCH] fix rmap walk during fork Andrea Arcangeli
@ 2010-09-15 19:49 ` Hugh Dickins
2010-09-15 20:10 ` Johannes Weiner
2010-09-15 20:38 ` Rik van Riel
2 siblings, 0 replies; 4+ messages in thread
From: Hugh Dickins @ 2010-09-15 19:49 UTC (permalink / raw)
To: Andrea Arcangeli; +Cc: linux-mm, Andrew Morton, Johannes Weiner, Rik van Riel
On Wed, 15 Sep 2010, Andrea Arcangeli wrote:
> From: Andrea Arcangeli <aarcange@redhat.com>
>
> The below bug in fork lead to the rmap walk finding the parent huge-pmd twice
> instead of just one, because the anon_vma_chain objects of the child vma still
> point to the vma->vm_mm of the parent. The below patch fixes it by making the
> rmap walk accurate during fork. It's not a big deal normally but it
> worth being accurate considering the cost is the same.
>
> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Hugh Dickins <hughd@google.com>
> ---
>
> diff --git a/kernel/fork.c b/kernel/fork.c
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -360,10 +360,10 @@ static int dup_mmap(struct mm_struct *mm
> if (IS_ERR(pol))
> goto fail_nomem_policy;
> vma_set_policy(tmp, pol);
> + tmp->vm_mm = mm;
> if (anon_vma_fork(tmp, mpnt))
> goto fail_nomem_anon_vma_fork;
> tmp->vm_flags &= ~VM_LOCKED;
> - tmp->vm_mm = mm;
> tmp->vm_next = tmp->vm_prev = NULL;
> file = tmp->vm_file;
> if (file) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fix rmap walk during fork
2010-09-15 17:16 [PATCH] fix rmap walk during fork Andrea Arcangeli
2010-09-15 19:49 ` Hugh Dickins
@ 2010-09-15 20:10 ` Johannes Weiner
2010-09-15 20:38 ` Rik van Riel
2 siblings, 0 replies; 4+ messages in thread
From: Johannes Weiner @ 2010-09-15 20:10 UTC (permalink / raw)
To: Andrea Arcangeli; +Cc: linux-mm, Andrew Morton, Rik van Riel, Hugh Dickins
On Wed, Sep 15, 2010 at 07:16:57PM +0200, Andrea Arcangeli wrote:
> From: Andrea Arcangeli <aarcange@redhat.com>
>
> The below bug in fork lead to the rmap walk finding the parent huge-pmd twice
> instead of just one, because the anon_vma_chain objects of the child vma still
> point to the vma->vm_mm of the parent. The below patch fixes it by making the
> rmap walk accurate during fork. It's not a big deal normally but it
> worth being accurate considering the cost is the same.
>
> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Johannes Weiner <jweiner@redhat.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fix rmap walk during fork
2010-09-15 17:16 [PATCH] fix rmap walk during fork Andrea Arcangeli
2010-09-15 19:49 ` Hugh Dickins
2010-09-15 20:10 ` Johannes Weiner
@ 2010-09-15 20:38 ` Rik van Riel
2 siblings, 0 replies; 4+ messages in thread
From: Rik van Riel @ 2010-09-15 20:38 UTC (permalink / raw)
To: Andrea Arcangeli; +Cc: linux-mm, Andrew Morton, Johannes Weiner, Hugh Dickins
On 09/15/2010 01:16 PM, Andrea Arcangeli wrote:
> From: Andrea Arcangeli<aarcange@redhat.com>
>
> The below bug in fork lead to the rmap walk finding the parent huge-pmd twice
> instead of just one, because the anon_vma_chain objects of the child vma still
> point to the vma->vm_mm of the parent. The below patch fixes it by making the
> rmap walk accurate during fork. It's not a big deal normally but it
> worth being accurate considering the cost is the same.
>
> Signed-off-by: Andrea Arcangeli<aarcange@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
--
All rights reversed
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-09-15 20:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 17:16 [PATCH] fix rmap walk during fork Andrea Arcangeli
2010-09-15 19:49 ` Hugh Dickins
2010-09-15 20:10 ` Johannes Weiner
2010-09-15 20:38 ` Rik van Riel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).