Re: [PATCH v33 1/7] sched/psi: Preserve sleep-persistent PSI flags on off-CPU sleeping dequeues

From: John Stultz

Date: Wed Nov 25 2026 - 20:40:04 EST


On Thu, Oct 29, 2026 at 3:02 PM Tejun Heo <tj@xxxxxxxxxx> wrote:
>
> Hello, John.
>
> This patch also fixes a trigger without proxy execution, through
> switching_from_fair(). A fair task sleeps in iowait and is delay-dequeued.
> sched_setscheduler() then moves it to SCHED_FIFO, and switching_from_fair()
> dequeues it with DEQUEUE_SLEEP | DEQUEUE_DELAYED. TSK_ONCPU is clear, so
> since c2ae8b0df2d1 ("sched/core: Fix psi_dequeue() for Proxy Execution")
> psi_dequeue() clears all of its psi flags, TSK_IOWAIT included. The wakeup's
> psi_enqueue() trips the check:
>
> psi: inconsistent task state! task=1318:python3 cpu=3 psi_flags=0 clear=1 set=4
>
> Tested on mainline 4dd16e31135e with CONFIG_SCHED_PROXY_EXEC disabled, each
> run a fresh boot. Without the patch, the reproducer below hit the warning on
> 10 of 10 boots within about a second. With only 1/7 applied, 0 of 10
> sixty-second boots hit it, while switching_from_fair() dequeued a delayed
> iowait task about 3,500 to 16,000 times per boot.
>
> Tested-by: Tejun Heo <tj@xxxxxxxxxx>

Hey Tejun!
Really appreciate your testing and validating this is needed outside
of proxy! Especially the reproducer! I'll include your tag in my next
iteration!
-john