]> git.ipfire.org Git - thirdparty/linux.git/commit
cpuset: Refactor exclusive CPU mask computation logic
authorChen Ridong <chenridong@huawei.com>
Wed, 17 Sep 2025 06:04:47 +0000 (06:04 +0000)
committerTejun Heo <tj@kernel.org>
Wed, 17 Sep 2025 18:37:30 +0000 (08:37 -1000)
commit86bbbd1f33ab31a20f6cacf88660333d25ef5fa4
treeff4b98f35be77c9149fe8a32cb9567a66236d52c
parent6a59fc4a3a5b19ea375b54ea70d16713c45ea5a0
cpuset: Refactor exclusive CPU mask computation logic

The current compute_effective_exclusive_cpumask function handles multiple
scenarios with different input parameters, making the code difficult to
follow. This patch refactors it into two separate functions:
compute_excpus and compute_trialcs_excpus.

The compute_excpus function calculates the exclusive CPU mask for a given
input and excludes exclusive CPUs from sibling cpusets when cs's
exclusive_cpus is not explicitly set.

The compute_trialcs_excpus function specifically handles exclusive CPU
computation for trial cpusets used during CPU mask configuration updates,
and always excludes exclusive CPUs from sibling cpusets.

This refactoring significantly improves code readability and clarity,
making it explicit which function to call for each use case and what
parameters should be provided.

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