summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2025-07-06 02:42:09 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-07-10 16:05:05 +0200
commit790ce73721abebf98f72555c9be9f0855e54a45c (patch)
tree712368929eee52607d20cd7e6e95df353248b4a0
parent7ccaa5fa5d25d53c66fb740964b23d9f98f72d32 (diff)
sched_ext: Make scx_group_set_weight() always update tg->scx.weight
[ Upstream commit c50784e99f0e7199cdb12dbddf02229b102744ef ] Otherwise, tg->scx.weight can go out of sync while scx_cgroup is not enabled and ops.cgroup_init() may be called with a stale weight value. Signed-off-by: Tejun Heo <tj@kernel.org> Fixes: 819513666966 ("sched_ext: Add cgroup support") Cc: stable@vger.kernel.org # v6.12+ Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--kernel/sched/ext.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index ddd4fa785264..c801dd20c63d 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -4058,12 +4058,12 @@ void scx_group_set_weight(struct task_group *tg, unsigned long weight)
{
percpu_down_read(&scx_cgroup_rwsem);
- if (scx_cgroup_enabled && tg->scx_weight != weight) {
- if (SCX_HAS_OP(cgroup_set_weight))
- SCX_CALL_OP(SCX_KF_UNLOCKED, cgroup_set_weight,
- tg_cgrp(tg), weight);
- tg->scx_weight = weight;
- }
+ if (scx_cgroup_enabled && SCX_HAS_OP(cgroup_set_weight) &&
+ tg->scx_weight != weight)
+ SCX_CALL_OP(SCX_KF_UNLOCKED, cgroup_set_weight,
+ tg_cgrp(tg), weight);
+
+ tg->scx_weight = weight;
percpu_up_read(&scx_cgroup_rwsem);
}