From: akpm@linux-foundation.org
To: akpm@linux-foundation.org, linux-mm@kvack.org,
mgorman@techsingularity.net, mm-commits@vger.kernel.org,
richardw.yang@linux.intel.com, torvalds@linux-foundation.org,
vbabka@suse.cz, willy@infradead.org
Subject: [patch 033/158] mm/mmap.c: rb_parent is not necessary in __vma_link_list()
Date: Sat, 30 Nov 2019 17:50:53 -0800 [thread overview]
Message-ID: <20191201015053.yBGUELT9h%akpm@linux-foundation.org> (raw)
From: Wei Yang <richardw.yang@linux.intel.com>
Subject: mm/mmap.c: rb_parent is not necessary in __vma_link_list()
Now we use rb_parent to get next, while this is not necessary.
When prev is NULL, this means vma should be the first element in the list.
Then next should be current first one (mm->mmap), no matter whether we
have parent or not.
After removing it, the code shows the beauty of symmetry.
Link: http://lkml.kernel.org/r/20190813032656.16625-1-richardw.yang@linux.intel.com
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/internal.h | 2 +-
mm/mmap.c | 2 +-
mm/nommu.c | 2 +-
mm/util.c | 8 ++------
4 files changed, 5 insertions(+), 9 deletions(-)
--- a/mm/internal.h~mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list
+++ a/mm/internal.h
@@ -290,7 +290,7 @@ static inline bool is_data_mapping(vm_fl
/* mm/util.c */
void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
- struct vm_area_struct *prev, struct rb_node *rb_parent);
+ struct vm_area_struct *prev);
void __vma_unlink_list(struct mm_struct *mm, struct vm_area_struct *vma);
#ifdef CONFIG_MMU
--- a/mm/mmap.c~mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list
+++ a/mm/mmap.c
@@ -641,7 +641,7 @@ __vma_link(struct mm_struct *mm, struct
struct vm_area_struct *prev, struct rb_node **rb_link,
struct rb_node *rb_parent)
{
- __vma_link_list(mm, vma, prev, rb_parent);
+ __vma_link_list(mm, vma, prev);
__vma_link_rb(mm, vma, rb_link, rb_parent);
}
--- a/mm/nommu.c~mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list
+++ a/mm/nommu.c
@@ -648,7 +648,7 @@ static void add_vma_to_mm(struct mm_stru
if (rb_prev)
prev = rb_entry(rb_prev, struct vm_area_struct, vm_rb);
- __vma_link_list(mm, vma, prev, parent);
+ __vma_link_list(mm, vma, prev);
}
/*
--- a/mm/util.c~mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list
+++ a/mm/util.c
@@ -271,7 +271,7 @@ void *memdup_user_nul(const void __user
EXPORT_SYMBOL(memdup_user_nul);
void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
- struct vm_area_struct *prev, struct rb_node *rb_parent)
+ struct vm_area_struct *prev)
{
struct vm_area_struct *next;
@@ -280,12 +280,8 @@ void __vma_link_list(struct mm_struct *m
next = prev->vm_next;
prev->vm_next = vma;
} else {
+ next = mm->mmap;
mm->mmap = vma;
- if (rb_parent)
- next = rb_entry(rb_parent,
- struct vm_area_struct, vm_rb);
- else
- next = NULL;
}
vma->vm_next = next;
if (next)
_
reply other threads:[~2019-12-01 1:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191201015053.yBGUELT9h%akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mm-commits@vger.kernel.org \
--cc=richardw.yang@linux.intel.com \
--cc=torvalds@linux-foundation.org \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox