summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianchen Ding <dtcccc@linux.alibaba.com>2022-01-18 18:05:18 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-05 12:38:59 +0100
commit6be234917788255d286f805b4601065648107fe4 (patch)
tree7b775a300a2e23c53f5f79a1d6a8f2e20cf77191
parentdef5e7070079b2a214b3b1a2fbec623e6fbfe34a (diff)
downloadlinux-stable-6be234917788255d286f805b4601065648107fe4.tar.gz
linux-stable-6be234917788255d286f805b4601065648107fe4.tar.bz2
linux-stable-6be234917788255d286f805b4601065648107fe4.zip
cpuset: Fix the bug that subpart_cpus updated wrongly in update_cpumask()
commit c80d401c52a2d1baf2a5afeb06f0ffe678e56d23 upstream. subparts_cpus should be limited as a subset of cpus_allowed, but it is updated wrongly by using cpumask_andnot(). Use cpumask_and() instead to fix it. Fixes: ee8dde0cd2ce ("cpuset: Add new v2 cpuset.sched.partition flag") Signed-off-by: Tianchen Ding <dtcccc@linux.alibaba.com> Reviewed-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--kernel/cgroup/cpuset.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 2a9695ccb65f..1d9d3e4d4cbc 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1597,8 +1597,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
* Make sure that subparts_cpus is a subset of cpus_allowed.
*/
if (cs->nr_subparts_cpus) {
- cpumask_andnot(cs->subparts_cpus, cs->subparts_cpus,
- cs->cpus_allowed);
+ cpumask_and(cs->subparts_cpus, cs->subparts_cpus, cs->cpus_allowed);
cs->nr_subparts_cpus = cpumask_weight(cs->subparts_cpus);
}
spin_unlock_irq(&callback_lock);