Skip to content

Commit 79692ef

Browse files
lizf-ossashalevin
authored andcommitted
cpuset: fix a warning when clearing configured masks in old hierarchy
[ Upstream commit 79063bf ] When we clear cpuset.cpus, cpuset.effective_cpus won't be cleared: # mount -t cgroup -o cpuset xxx /mnt # mkdir /mnt/tmp # echo 0 > /mnt/tmp/cpuset.cpus # echo > /mnt/tmp/cpuset.cpus # cat cpuset.cpus # cat cpuset.effective_cpus 0-15 And a kernel warning in update_cpumasks_hier() is triggered: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 4028 at kernel/cpuset.c:894 update_cpumasks_hier+0x471/0x650() Cc: <stable@vger.kernel.org> # 3.17+ Signed-off-by: Zefan Li <lizefan@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org> Tested-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 parent dacb6cc commit 79692ef

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎kernel/cpuset.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ static void update_cpumasks_hier(struct cpuset *cs, struct cpumask *new_cpus)
863863
* If it becomes empty, inherit the effective mask of the
864864
* parent, which is guaranteed to have some CPUs.
865865
*/
866-
if (cpumask_empty(new_cpus))
866+
if (cgroup_on_dfl(cp->css.cgroup) && cpumask_empty(new_cpus))
867867
cpumask_copy(new_cpus, parent->effective_cpus);
868868

869869
/* Skip the whole subtree if the cpumask remains the same. */
@@ -1119,7 +1119,7 @@ static void update_nodemasks_hier(struct cpuset *cs, nodemask_t *new_mems)
11191119
* If it becomes empty, inherit the effective mask of the
11201120
* parent, which is guaranteed to have some MEMs.
11211121
*/
1122-
if (nodes_empty(*new_mems))
1122+
if (cgroup_on_dfl(cp->css.cgroup) && nodes_empty(*new_mems))
11231123
*new_mems = parent->effective_mems;
11241124

11251125
/* Skip the whole subtree if the nodemask remains the same. */

0 commit comments

Comments
 (0)