Commit 808fbdbe authored by Wei Yang's avatar Wei Yang Committed by Linus Torvalds

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: default avatarWei Yang <richard.weiyang@linux.alibaba.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Link: https://lkml.kernel.org/r/20200913133631.37781-1-richard.weiyang@linux.alibaba.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f1dc1685
...@@ -895,10 +895,9 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start, ...@@ -895,10 +895,9 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
anon_vma_interval_tree_post_update_vma(next); anon_vma_interval_tree_post_update_vma(next);
anon_vma_unlock_write(anon_vma); anon_vma_unlock_write(anon_vma);
} }
if (mapping)
i_mmap_unlock_write(mapping);
if (root) { if (root) {
i_mmap_unlock_write(mapping);
uprobe_mmap(vma); uprobe_mmap(vma);
if (adjust_next) if (adjust_next)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment