Re: [PATCH] sched_ext: Choose the right sch->ops.name to output in the print_scx_info()

Tejun Heo
2026-03-24T14:37:35Z

On Tue, Mar 24, 2026 at 08:03:13PM +0800, Zqiang wrote:
> This commit use the scx_task_sched_rcu() to get task->scx.sched

"This commit uses", but that just do imperative - "Use the...".

> structure to correctly output, instead of always using scx_root
> in the print_scx_info().
>
> Signed-off-by: Zqiang <qiang.zhang@linux.dev>
> ---
> kernel/sched/ext.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 2472231ec556..5d670b50da3d 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -7680,14 +7680,18 @@ static void kick_cpus_irq_workfn(struct irq_work *irq_work)
> */
> void print_scx_info(const char *log_lvl, struct task_struct *p)
> {
> - struct scx_sched *sch = scx_root;
> + struct scx_sched *sch;
> enum scx_enable_state state = scx_enable_state();
> const char *all = READ_ONCE(scx_switching_all) ? "+all" : "";
> char runnable_at_buf[22] = "?";
> struct sched_class *class;
> unsigned long runnable_at;
>
> - if (state == SCX_DISABLED)
> + guard(rcu)();
> +
> + sch = scx_task_sched_rcu(p);
> +
> + if (!sch || state == SCX_DISABLED)

I think you can drop the state test w/ scx_task_sched_rcu() usage.

Thanks.

--
tejun