The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] sched_ext: Fix exit_task leak on fork failure during enable
@ 2026-08-14  3:26 Qiurong Fang
  2026-08-14 19:21 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Qiurong Fang @ 2026-08-14  3:26 UTC (permalink / raw)
  To: tj; +Cc: void, arighi, changwoo, sched-ext, linux-kernel

From: fangqiurong <fangqiurong@kylinos.cn>

scx_fork() initializes tasks when scx_init_task_enabled is set, but
scx_cancel_fork() only exits them when scx_enabled() is true. A fork
that fails in the enable window (between releasing scx_fork_rwsem and
setting __scx_enabled) runs ops.init_task() but never ops.exit_task()

Gate scx_cancel_fork() on scx_init_task_enabled.

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

diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index 29967bb130c5..334472b91cd2 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -4177,7 +4177,7 @@ void scx_post_fork(struct task_struct *p)
 
 void scx_cancel_fork(struct task_struct *p)
 {
-	if (scx_enabled()) {
+	if (scx_init_task_enabled) {
 		struct rq *rq;
 		struct rq_flags rf;
 
-- 
2.43.0


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

* Re: [PATCH] sched_ext: Fix exit_task leak on fork failure during enable
  2026-08-14  3:26 [PATCH] sched_ext: Fix exit_task leak on fork failure during enable Qiurong Fang
@ 2026-08-14 19:21 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2026-08-14 19:21 UTC (permalink / raw)
  To: Qiurong Fang; +Cc: void, arighi, changwoo, emil, sched-ext, linux-kernel

Applied to sched_ext/for-7.3 with the following tags added:

    Fixes: 4269c603cc26 ("sched_ext: Enable scx_ops_init_task() separately")
    Cc: stable@vger.kernel.org # v6.12+

Thanks.

--
tejun

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

end of thread, other threads:[~2026-08-14 19:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14  3:26 [PATCH] sched_ext: Fix exit_task leak on fork failure during enable Qiurong Fang
2026-08-14 19:21 ` Tejun Heo

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