diff options
author | Wei Yang <richard.weiyang@linux.alibaba.com> | 2020-10-13 16:54:04 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-13 18:38:31 -0700 |
commit | 808fbdbea05f1e965da5b887d808025ba22c1946 (patch) | |
tree | 9747f34858417c3cdbeb1188020e3820f55f63e0 | |
parent | f1dc1685f6ca25d435d58d16e53bb6f336f54cac (diff) | |
download | linux-stable-808fbdbea05f1e965da5b887d808025ba22c1946.tar.gz linux-stable-808fbdbea05f1e965da5b887d808025ba22c1946.tar.bz2 linux-stable-808fbdbea05f1e965da5b887d808025ba22c1946.zip |
mm/mmap: not necessary to check mapping separately
*root* with type of struct rb_root_cached is an element of *mapping*
with type of struct address_space. This implies when we have a valid
*root* it must be a part of valid *mapping*.
So we can merge these two checks together to make the code more easy to
read and to save some cpu cycles.
Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Link: https://lkml.kernel.org/r/20200913133631.37781-1-richard.weiyang@linux.alibaba.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/mmap.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/mmap.c b/mm/mmap.c index 57de816e2614..295197b75cb0 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -895,10 +895,9 @@ again: anon_vma_interval_tree_post_update_vma(next); anon_vma_unlock_write(anon_vma); } - if (mapping) - i_mmap_unlock_write(mapping); if (root) { + i_mmap_unlock_write(mapping); uprobe_mmap(vma); if (adjust_next) |