From: Wei Yang Date: Tue, 13 Oct 2020 23:54:04 +0000 (-0700) Subject: mm/mmap: not necessary to check mapping separately X-Git-Tag: howlett/maple_spf/20210104~841^2~77 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=808fbdbea05f1e965da5b887d808025ba22c1946;p=users%2Fjedix%2Flinux-maple.git 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 Signed-off-by: Andrew Morton Reviewed-by: Andrew Morton Link: https://lkml.kernel.org/r/20200913133631.37781-1-richard.weiyang@linux.alibaba.com Signed-off-by: Linus Torvalds --- 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)