summaryrefslogtreecommitdiff
path: root/kernel/cgroup/cpuset-v1.c
diff options
context:
space:
mode:
authorChen Ridong <chenridong@huawei.com>2025-12-18 09:31:39 +0000
committerTejun Heo <tj@kernel.org>2025-12-18 08:36:15 -1000
commitcb33f8814c4af3c917fa249cd9ef34b17a5ef562 (patch)
treedf2a4c427c035bf0c9d8197420c88e300d68a6f4 /kernel/cgroup/cpuset-v1.c
parent4ef42c645f0ec9b56f0715204013a27c2fec801e (diff)
downloadlinux-next-cb33f8814c4af3c917fa249cd9ef34b17a5ef562.tar.gz
linux-next-cb33f8814c4af3c917fa249cd9ef34b17a5ef562.zip
cpuset: move update_domain_attr_tree to cpuset_v1.c
Since relax_domain_level is only applicable to v1, move update_domain_attr_tree() to cpuset-v1.c, which solely updates relax_domain_level, Additionally, relax_domain_level is now initialized in cpuset1_inited. Accordingly, the initialization of relax_domain_level in top_cpuset is removed. The unnecessary remote_partition initialization in top_cpuset is also cleaned up. As a result, relax_domain_level can be defined in cpuset only when CONFIG_CPUSETS_V1=y. Signed-off-by: Chen Ridong <chenridong@huawei.com> Reviewed-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/cgroup/cpuset-v1.c')
-rw-r--r--kernel/cgroup/cpuset-v1.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/kernel/cgroup/cpuset-v1.c b/kernel/cgroup/cpuset-v1.c
index 84f00ab9c81f..a4f8f1c3cfaa 100644
--- a/kernel/cgroup/cpuset-v1.c
+++ b/kernel/cgroup/cpuset-v1.c
@@ -502,6 +502,7 @@ out_unlock:
void cpuset1_init(struct cpuset *cs)
{
fmeter_init(&cs->fmeter);
+ cs->relax_domain_level = -1;
}
void cpuset1_online_css(struct cgroup_subsys_state *css)
@@ -552,6 +553,33 @@ void cpuset1_online_css(struct cgroup_subsys_state *css)
cpuset_callback_unlock_irq();
}
+static void
+update_domain_attr(struct sched_domain_attr *dattr, struct cpuset *c)
+{
+ if (dattr->relax_domain_level < c->relax_domain_level)
+ dattr->relax_domain_level = c->relax_domain_level;
+}
+
+void update_domain_attr_tree(struct sched_domain_attr *dattr,
+ struct cpuset *root_cs)
+{
+ struct cpuset *cp;
+ struct cgroup_subsys_state *pos_css;
+
+ rcu_read_lock();
+ cpuset_for_each_descendant_pre(cp, pos_css, root_cs) {
+ /* skip the whole subtree if @cp doesn't have any CPU */
+ if (cpumask_empty(cp->cpus_allowed)) {
+ pos_css = css_rightmost_descendant(pos_css);
+ continue;
+ }
+
+ if (is_sched_load_balance(cp))
+ update_domain_attr(dattr, cp);
+ }
+ rcu_read_unlock();
+}
+
/*
* for the common functions, 'private' gives the type of file
*/