]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sched_ext: Choose the right sch->ops.name to output in the print_scx_info()
authorZqiang <qiang.zhang@linux.dev>
Wed, 25 Mar 2026 03:11:00 +0000 (11:11 +0800)
committerTejun Heo <tj@kernel.org>
Wed, 25 Mar 2026 04:21:15 +0000 (18:21 -1000)
The print_scx_info() always output scx_root structure's->ops.name,
but for built with CONFIG_EXT_SUB_SCHED=y kernels, the tasks may be
attach an sub scx_sched structure. this commit therefore use the
scx_task_sched_rcu() to correctly get scx_sched structure to output
ops.name, and drop state check.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Zqiang <qiang.zhang@linux.dev>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c

index 2472231ec5566fa830e37346ecf00a63168519a8..551bfb99157d1720dbb5895218a53349747167e6 100644 (file)
@@ -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)
                return;
 
        /*