diff options
author | Wei Yang <richard.weiyang@linux.alibaba.com> | 2020-10-14 01:57:08 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-14 03:38:34 +0200 |
commit | 78b132e9bae922f1e8bd9d137f0c27b81c44f15d (patch) | |
tree | 8d1ffce6a4258e1825859d92e86d521d52d78f64 /mm/mempolicy.c | |
parent | selftests/vm: 8x compaction_test speedup (diff) | |
download | linux-78b132e9bae922f1e8bd9d137f0c27b81c44f15d.tar.xz linux-78b132e9bae922f1e8bd9d137f0c27b81c44f15d.zip |
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.
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/20200921040416.86185-1-richard.weiyang@linux.alibaba.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r-- | mm/mempolicy.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index eddbe4e56c73..69ce708c3a3a 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -875,13 +875,12 @@ static long do_set_mempolicy(unsigned short mode, unsigned short flags, 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, unsigned long len, 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 |