Re: [PATCH v4 sched_ext/for-7.3 01/40] sched_ext: Record an error on errno-only sub-enable failure

Andrea Righi <[email protected]>
Newsgroups dev.linux.lists.sched-ext,org.kernel.vger.linux-kernel
Message-ID <alAGml78WoUn-p5e@gpd4>
On Wed, Jul 08, 2026 at 11:23:50AM -1000, Tejun Heo wrote:
> scx_sub_enable_workfn() has several failure paths that only return an errno
> (e.g. -ENOMEM from an allocation) and jump to err_disable without calling
> scx_error(). scx_flush_disable_work() runs the disable, and thus ops.exit(),
> only when an error has been recorded, so an errno-only failure leaves the
> half-initialized sub-scheduler linked.
> 
> Record an error at the err_disable sink so every errno-only failure runs the
> disable path.
> 
> Fixes: ebeca1f930ea ("sched_ext: Introduce cgroup sub-sched support")
> Signed-off-by: Tejun Heo <[email protected]>

Reviewed-by: Andrea Righi <[email protected]>

Thanks,
-Andrea

> ---
>  kernel/sched/ext/sub.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/kernel/sched/ext/sub.c b/kernel/sched/ext/sub.c
> index 050420427273..ce76ae141e0a 100644
> --- a/kernel/sched/ext/sub.c
> +++ b/kernel/sched/ext/sub.c
> @@ -570,6 +570,12 @@ void scx_sub_enable_workfn(struct kthread_work *work)
>  	percpu_up_write(&scx_fork_rwsem);
>  err_disable:
>  	mutex_unlock(&scx_enable_mutex);
> +	/*
> +	 * Some enable failures only return an errno (e.g. -ENOMEM from an
> +	 * allocation) without calling scx_error(). Record it so
> +	 * scx_flush_disable_work() runs the disable and ops.exit() fires.
> +	 */
> +	scx_error(sch, "scx_sub_enable() failed (%d)", ret);
>  	scx_flush_disable_work(sch);
>  	cmd->ret = 0;
>  }
> -- 
> 2.54.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.