linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/rmap.c: remove useless checking to child vma->vm_prev in anon_vma_clone
@ 2020-01-06  6:37 Li Xinhai
  2020-01-06 10:43 ` Konstantin Khlebnikov
  0 siblings, 1 reply; 4+ messages in thread
From: Li Xinhai @ 2020-01-06  6:37 UTC (permalink / raw)
  To: linux-mm; +Cc: Wei Yang, Konstantin Khlebnikov, Kirill A. Shutemov

For fork case, the dst->vm_prev is always same as src->vm_prev when
anon_vma_clone() is called. Removing the assignment from
dst->vm_prev->anon_vma to dst->anon_vma, and explictly assign from
anon_vma which is shared by its parent vmas.

Signed-off-by: Li Xinhai <lixinhai.lxh@gmail.com>
Cc: Wei Yang <richardw.yang@linux.intel.com>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
 mm/rmap.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index b3e3819..3c912a6c 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -269,10 +269,10 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src)
 {
 	struct anon_vma_chain *avc, *pavc;
 	struct anon_vma *root = NULL;
-	struct vm_area_struct *prev = dst->vm_prev, *pprev = src->vm_prev;
+	struct vm_area_struct *pprev = src->vm_prev;
 
 	/*
-	 * If parent share anon_vma with its vm_prev, keep this sharing in in
+	 * If parent share anon_vma with its vm_prev, keep this sharing in
 	 * child.
 	 *
 	 * 1. Parent has vm_prev, which implies we have vm_prev.
@@ -280,8 +280,7 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src)
 	 */
 	if (!dst->anon_vma && src->anon_vma &&
 	    pprev && pprev->anon_vma == src->anon_vma)
-		dst->anon_vma = prev->anon_vma;
-
+		dst->anon_vma = pprev->anon_vma;
 
 	list_for_each_entry_reverse(pavc, &src->anon_vma_chain, same_vma) {
 		struct anon_vma *anon_vma;
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-06 20:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06  6:37 [PATCH] mm/rmap.c: remove useless checking to child vma->vm_prev in anon_vma_clone Li Xinhai
2020-01-06 10:43 ` Konstantin Khlebnikov
2020-01-06 13:28   ` lixinhai.lxh
2020-01-06 20:20     ` Konstantin Khlebnikov

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