Skip to content

Commit c50784e

Browse files
committed
sched_ext: Make scx_group_set_weight() always update tg->scx.weight
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 <[email protected]> Fixes: 8195136 ("sched_ext: Add cgroup support") Cc: [email protected] # v6.12+
1 parent 47096d3 commit c50784e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

kernel/sched/ext.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4241,12 +4241,12 @@ void scx_group_set_weight(struct task_group *tg, unsigned long weight)
42414241

42424242
percpu_down_read(&scx_cgroup_rwsem);
42434243

4244-
if (scx_cgroup_enabled && tg->scx_weight != weight) {
4245-
if (SCX_HAS_OP(sch, cgroup_set_weight))
4246-
SCX_CALL_OP(sch, SCX_KF_UNLOCKED, cgroup_set_weight, NULL,
4247-
tg_cgrp(tg), weight);
4248-
tg->scx_weight = weight;
4249-
}
4244+
if (scx_cgroup_enabled && SCX_HAS_OP(sch, cgroup_set_weight) &&
4245+
tg->scx_weight != weight)
4246+
SCX_CALL_OP(sch, SCX_KF_UNLOCKED, cgroup_set_weight, NULL,
4247+
tg_cgrp(tg), weight);
4248+
4249+
tg->scx_weight = weight;
42504250

42514251
percpu_up_read(&scx_cgroup_rwsem);
42524252
}

0 commit comments

Comments
 (0)