]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
cpuset: separate generate_sched_domains for v1 and v2
authorChen Ridong <chenridong@huawei.com>
Thu, 18 Dec 2025 09:31:40 +0000 (09:31 +0000)
committerTejun Heo <tj@kernel.org>
Thu, 18 Dec 2025 18:36:15 +0000 (08:36 -1000)
commit6e1d31ce495c35c12913246586bb04aac019b8e3
treec9d10110a04d6b9d4876759a45121ab63bfb230f
parentcb33f8814c4af3c917fa249cd9ef34b17a5ef562
cpuset: separate generate_sched_domains for v1 and v2

The generate_sched_domains() function currently handles both v1 and v2
logic. However, the underlying mechanisms for building scheduler domains
differ significantly between the two versions. For cpuset v2, scheduler
domains are straightforwardly derived from valid partitions, whereas
cpuset v1 employs a more complex union-find algorithm to merge overlapping
cpusets. Co-locating these implementations complicates maintenance.

This patch, along with subsequent ones, aims to separate the v1 and v2
logic. For ease of review, this patch first copies the
generate_sched_domains() function into cpuset-v1.c as
cpuset1_generate_sched_domains() and removes v2-specific code. Common
helpers and top_cpuset are declared in cpuset-internal.h. When operating
in v1 mode, the code now calls cpuset1_generate_sched_domains().

Currently there is some code duplication, which will be largely eliminated
once v1-specific code is removed from v2 in the following patch.

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-internal.h
kernel/cgroup/cpuset-v1.c
kernel/cgroup/cpuset.c