Re: [PATCH 2/2] sched_ext: Dump the stall CPU first in watchdog exit

From: Andrea Righi

Date: Thu Apr 09 2026 - 01:52:42 EST


On Wed, Apr 08, 2026 at 03:19:33PM -1000, Tejun Heo wrote:
> On Wed, Apr 08, 2026 at 12:11:13PM +0900, Changwoo Min wrote:
> > When a watchdog timeout fires, the CPU where the stalled task was
> > running is the most relevant piece of information for diagnosing the
> > hang. However, if there are many CPUs, the dump can get truncated and
> > the stall CPU's information may not appear in the output.
> >
> > Add a stall_cpu field to scx_exit_info, thread it through scx_vexit()
> > and __scx_exit(), and populate it from cpu_of(rq) in
> > check_rq_for_timeouts(). In scx_dump_state(), dump the stall CPU
> > before iterating the rest so it always appears at the top of the output.
> >
> > Introduce a scx_exit() macro that wraps __scx_exit() with stall_cpu=0
> > for all non-stall exit paths, keeping call sites unchanged.
>
> Would it make sense to generalize this so that the exit record the CPU the
> exit is triggered on and always dump that CPU first? That should include
> stall case, is likely useful for different cases too and we don't have to
> add @stall_cpu to the exit functions.

But if we record the current CPU the exit is triggered on, in
check_rq_for_timeouts() we would prioritize the watchdog worker's CPU instead of
the stalled one, right?

Thanks,
-Andrea