The patch titled Subject: mm/mmap: not necessary to check mapping separately has been added to the -mm tree. Its filename is mm-mmap-not-necessary-to-check-mapping-separately.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-mmap-not-necessary-to-check-mapping-separately.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-mmap-not-necessary-to-check-mapping-separately.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Wei Yang <richard.weiyang@xxxxxxxxxxxxxxxxx> Subject: 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. Link: https://lkml.kernel.org/r/20200913133631.37781-1-richard.weiyang@xxxxxxxxxxxxxxxxx Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/mmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/mm/mmap.c~mm-mmap-not-necessary-to-check-mapping-separately +++ a/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) _ Patches currently in -mm which might be from richard.weiyang@xxxxxxxxxxxxxxxxx are mm-mmap-rename-__vma_unlink_common-to-__vma_unlink.patch mm-mmap-leverage-vma_rb_erase_ignore-to-implement-vma_rb_erase.patch mm-mmap-leave-adjust_next-as-virtual-address-instead-of-page-frame-number.patch mm-mmap-not-necessary-to-check-mapping-separately.patch mm-mmap-check-on-file-instead-of-the-rb_root_cached-of-its-address_space.patch mm-hugetlb-not-necessary-to-coalesce-regions-recursively.patch mm-hugetlb-remove-vm_bug_onnrg-in-get_file_region_entry_from_cache.patch mm-hugetlb-use-list_splice-to-merge-two-list-at-once.patch mm-hugetlb-count-file_region-to-be-added-when-regions_needed-=-null.patch mm-hugetlb-a-page-from-buddy-is-not-on-any-list.patch mm-hugetlb-narrow-the-hugetlb_lock-protection-area-during-preparing-huge-page.patch mm-hugetlb-take-the-free-hpage-during-the-iteration-directly.patch mm-hugetlb-take-the-free-hpage-during-the-iteration-directly-v4.patch mm-page_reporting-drop-stale-list-head-check-in-page_reporting_cycle.patch bitops-simplify-get_count_order_long.patch bitops-use-the-same-mechanism-for-get_count_order.patch