The patch titled Subject: mm/mempolicy: remove or narrow the lock on current has been added to the -mm tree. Its filename is mm-mempolicy-remove-or-narrow-the-lock-on-current.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-mempolicy-remove-or-narrow-the-lock-on-current.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-mempolicy-remove-or-narrow-the-lock-on-current.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/mempolicy: remove or narrow the lock on current It is not necessary to hold the lock of current when setting nodemask of a new policy. Link: https://lkml.kernel.org/r/20200921040416.86185-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/mempolicy.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/mm/mempolicy.c~mm-mempolicy-remove-or-narrow-the-lock-on-current +++ a/mm/mempolicy.c @@ -875,13 +875,12 @@ static long do_set_mempolicy(unsigned sh goto out; } - task_lock(current); ret = mpol_set_nodemask(new, nodes, scratch); if (ret) { - task_unlock(current); mpol_put(new); goto out; } + task_lock(current); old = current->mempolicy; current->mempolicy = new; if (new && new->mode == MPOL_INTERLEAVE) @@ -1324,9 +1323,7 @@ static long do_mbind(unsigned long start NODEMASK_SCRATCH(scratch); if (scratch) { mmap_write_lock(mm); - task_lock(current); err = mpol_set_nodemask(new, nmask, scratch); - task_unlock(current); if (err) mmap_write_unlock(mm); } else _ 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-mempolicy-remove-or-narrow-the-lock-on-current.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