Skip to content

Commit 34a0b13

Browse files
Sasha Levingregkh
authored andcommitted
sched_ext: Make scx_group_set_weight() always update tg->scx.weight
[ Upstream commit c50784e ] 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: 8195136 ("sched_ext: Add cgroup support") Cc: stable@vger.kernel.org # v6.12+ Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 69cc2e1 commit 34a0b13

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

kernel/sched/ext.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4074,12 +4074,12 @@ void scx_group_set_weight(struct task_group *tg, unsigned long weight)
40744074
{
40754075
percpu_down_read(&scx_cgroup_rwsem);
40764076

4077-
if (scx_cgroup_enabled && tg->scx_weight != weight) {
4078-
if (SCX_HAS_OP(cgroup_set_weight))
4079-
SCX_CALL_OP(SCX_KF_UNLOCKED, cgroup_set_weight, NULL,
4080-
tg_cgrp(tg), weight);
4081-
tg->scx_weight = weight;
4082-
}
4077+
if (scx_cgroup_enabled && SCX_HAS_OP(cgroup_set_weight) &&
4078+
tg->scx_weight != weight)
4079+
SCX_CALL_OP(SCX_KF_UNLOCKED, cgroup_set_weight, NULL,
4080+
tg_cgrp(tg), weight);
4081+
4082+
tg->scx_weight = weight;
40834083

40844084
percpu_up_read(&scx_cgroup_rwsem);
40854085
}

0 commit comments

Comments
 (0)