linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2 sched_ext/for-6.16-fixes] sched_ext: Make scx_group_set_weight() always update tg->scx.weight
@ 2025-06-13 23:23 Tejun Heo
  2025-06-13 23:25 ` [PATCH 2/2 sched_ext/for-6.16-fixes] sched_ext, sched/core: Don't call scx_group_set_weight() prematurely from sched_create_group() Tejun Heo
  0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2025-06-13 23:23 UTC (permalink / raw)
  To: David Vernet, Andrea Righi, Changwoo Min; +Cc: linux-kernel

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+
---
 kernel/sched/ext.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -4241,12 +4241,12 @@ void scx_group_set_weight(struct task_gr
 
 	percpu_down_read(&scx_cgroup_rwsem);
 
-	if (scx_cgroup_enabled && tg->scx_weight != weight) {
-		if (SCX_HAS_OP(sch, cgroup_set_weight))
-			SCX_CALL_OP(sch, SCX_KF_UNLOCKED, cgroup_set_weight, NULL,
-				    tg_cgrp(tg), weight);
-		tg->scx_weight = weight;
-	}
+	if (scx_cgroup_enabled && SCX_HAS_OP(sch, cgroup_set_weight) &&
+	    tg->scx_weight != weight)
+		SCX_CALL_OP(sch, SCX_KF_UNLOCKED, cgroup_set_weight, NULL,
+			    tg_cgrp(tg), weight);
+
+	tg->scx_weight = weight;
 
 	percpu_up_read(&scx_cgroup_rwsem);
 }


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-17 18:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-13 23:23 [PATCH 1/2 sched_ext/for-6.16-fixes] sched_ext: Make scx_group_set_weight() always update tg->scx.weight Tejun Heo
2025-06-13 23:25 ` [PATCH 2/2 sched_ext/for-6.16-fixes] sched_ext, sched/core: Don't call scx_group_set_weight() prematurely from sched_create_group() Tejun Heo
2025-06-16 20:13   ` [PATCH v2 " Tejun Heo
2025-06-17 18:20     ` Tejun Heo
2025-06-17  8:30   ` [PATCH " Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).