From: Wei Yang <richard.weiyang@linux.alibaba.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Wei Yang <richard.weiyang@linux.alibaba.com>
Subject: [PATCH 2/2] mm/mmap: check on file instead of the rb_root_cached of its address_space
Date: Sun, 13 Sep 2020 21:36:31 +0800 [thread overview]
Message-ID: <20200913133631.37781-2-richard.weiyang@linux.alibaba.com> (raw)
In-Reply-To: <20200913133631.37781-1-richard.weiyang@linux.alibaba.com>
In __vma_adjust(), we do the check on *root* to decide whether to adjust
the address_space. While it seems to be more meaningful to do the check
on *file* itself. This means we are adjust some data because it is a
file backed vma.
Since we seems to assume the address_space is valid if it is a file
backed vma, let's just replace *root* with *file* here.
Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
---
mm/mmap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index 30b155098606..829897646a9c 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -823,7 +823,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
anon_vma_interval_tree_pre_update_vma(next);
}
- if (root) {
+ if (file) {
flush_dcache_mmap_lock(mapping);
vma_interval_tree_remove(vma, root);
if (adjust_next)
@@ -844,7 +844,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
next->vm_pgoff += adjust_next >> PAGE_SHIFT;
}
- if (root) {
+ if (file) {
if (adjust_next)
vma_interval_tree_insert(next, root);
vma_interval_tree_insert(vma, root);
@@ -896,7 +896,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
anon_vma_unlock_write(anon_vma);
}
- if (root) {
+ if (file) {
i_mmap_unlock_write(mapping);
uprobe_mmap(vma);
--
2.20.1 (Apple Git-117)
prev parent reply other threads:[~2020-09-13 13:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-13 13:36 [PATCH 1/2] mm/mmap: not necessary to check mapping separately Wei Yang
2020-09-13 13:36 ` Wei Yang [this message]
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=20200913133631.37781-2-richard.weiyang@linux.alibaba.com \
--to=richard.weiyang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).