Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cgroup/cpuset: Streamline rm_siblings_excl_cpus()

If exclusive_cpus is set, effective_xcpus must be a subset of
exclusive_cpus. Currently, rm_siblings_excl_cpus() checks both
exclusive_cpus and effective_xcpus consecutively. It is simpler
to check only exclusive_cpus if non-empty or just effective_xcpus
otherwise.

No functional change is expected.

Signed-off-by: Waiman Long <longman@redhat.com>
Reviewed-by: Chen Ridong <chenridong@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Waiman Long and committed by
Tejun Heo
18bc2425 269679bd

+15 -9
+15 -9
kernel/cgroup/cpuset.c
··· 1355 1355 int retval = 0; 1356 1356 1357 1357 if (cpumask_empty(excpus)) 1358 - return retval; 1358 + return 0; 1359 1359 1360 1360 /* 1361 - * Exclude exclusive CPUs from siblings 1361 + * Remove exclusive CPUs from siblings 1362 1362 */ 1363 1363 rcu_read_lock(); 1364 1364 cpuset_for_each_child(sibling, css, parent) { 1365 + struct cpumask *sibling_xcpus; 1366 + 1365 1367 if (sibling == cs) 1366 1368 continue; 1367 1369 1368 - if (cpumask_intersects(excpus, sibling->exclusive_cpus)) { 1369 - cpumask_andnot(excpus, excpus, sibling->exclusive_cpus); 1370 - retval++; 1371 - continue; 1372 - } 1373 - if (cpumask_intersects(excpus, sibling->effective_xcpus)) { 1374 - cpumask_andnot(excpus, excpus, sibling->effective_xcpus); 1370 + /* 1371 + * If exclusive_cpus is defined, effective_xcpus will always 1372 + * be a subset. Otherwise, effective_xcpus will only be set 1373 + * in a valid partition root. 1374 + */ 1375 + sibling_xcpus = cpumask_empty(sibling->exclusive_cpus) 1376 + ? sibling->effective_xcpus 1377 + : sibling->exclusive_cpus; 1378 + 1379 + if (cpumask_intersects(excpus, sibling_xcpus)) { 1380 + cpumask_andnot(excpus, excpus, sibling_xcpus); 1375 1381 retval++; 1376 1382 } 1377 1383 }