Sched_ext development
 help / color / mirror / Atom feed
* [PATCH] sched_ext: Set errno on ENABLING -> ENABLED transition failure
@ 2026-07-28  6:09 luoliang
  2026-07-28  6:28 ` sashiko-bot
  2026-08-02 20:20 ` Tejun Heo
  0 siblings, 2 replies; 4+ messages in thread
From: luoliang @ 2026-07-28  6:09 UTC (permalink / raw)
  To: Tejun Heo
  Cc: David Vernet, Andrea Righi, Changwoo Min, sched-ext, linux-kernel,
	Liang Luo

From: Liang Luo <luoliang@kylinos.cn>

If the SCX_ENABLING -> SCX_ENABLED cmpxchg at the tail of
scx_root_enable_workfn() fails, the function jumps to err_disable
without setting ret. At that point ret still holds the return value
of the last successful __scx_init_task() call, which is 0, so the
err_disable fallback reports the meaningless message:

  scx_root_enable() failed (0)

Set ret = -EBUSY, consistent with the other enable-state guards at
the top of the same function, so the fallback always reports a real
errno.

Signed-off-by: Liang Luo <luoliang@kylinos.cn>
---
 kernel/sched/ext/ext.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index 312938179e52..6a3e94707c8b 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -7520,6 +7520,7 @@ static void scx_root_enable_workfn(struct kthread_work *work)
 
 	if (!scx_tryset_enable_state(SCX_ENABLED, SCX_ENABLING)) {
 		WARN_ON_ONCE(atomic_read(&sch->exit_kind) == SCX_EXIT_NONE);
+		ret = -EBUSY;
 		goto err_disable;
 	}
 
-- 
2.43.0


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

end of thread, other threads:[~2026-08-02 20:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28  6:09 [PATCH] sched_ext: Set errno on ENABLING -> ENABLED transition failure luoliang
2026-07-28  6:28 ` sashiko-bot
2026-07-28  7:03   ` luoliang
2026-08-02 20:20 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox