Re: [PATCH] sched/stats: Fix run_delay over-count for proxy-migrated blocked donors
From: Kayra Cizmeci
Date: Mon Oct 26 2026 - 10:48:50 EST
On Mon, Oct 26, 2026 at 09:53:51PM +0800, albin_yang@xxxxxxx wrote:
> Hi Kayra,
>
> Thanks for your review.
>
> > ... sched_info_dequeue() ... Or Am I missing something?
>
> No, you're right: the fake enqueue starts the counter at migration time, and
> the bill is settled later in sched_info_dequeue() on the proxy_needs_return()
> path (dequeue_block_task() with TASK_WAKING). The ~167 ms I measured is that
> delta. I had written sched_info_arrive() charging it directly, which is wrong -
> I'll fix the description.
>
> > This should be a series instead of separate patches if this goes above.
>
> Agreed - I'll resend as [PATCH v5 1/2] (DELAY_DEQUEUE fix) + [PATCH v5 2/2]
> (this one).
>
> > ... when B gets a kill signal B need to enqueue separately from A, so it
> > starts to wait. But blocked_on is set, so B's counter never starts.
>
> A case I hadn't considered, and my sanity check does not cover it: I only
> verified that a donor waking normally and then contending for the CPU still
> accumulates run_delay. A waiter enqueuing separately from its owner does
> genuinely start waiting for a CPU.
>
> So let me ask first: in that path, is blocked_on really still set when B is
> enqueued separately? If yes, !task_is_blocked() would under-count B, and the
> options as I see them are:
AFAICT from the code, yes. BTW, I thought about this and I think a
separate fix would be better clearing blocked_on in this case. Since
the task is really waiting for CPU time. Separate from its owner.
Or am I missing something and this accually does not works?
>
> a) a predicate that is also cleared on that path,
> b) clear blocked_on there (proxy-exec territory - for you/John/Peter),
> c) hold this patch until John's series lands and re-evaluate then,
> d) fix it at the source instead: give proxy_migrate_task() DEQUEUE_SAVE /
> ENQUEUE_RESTORE so the migration never touches sched_info at all. That
> sidesteps the blocked_on question entirely, but it also affects psi, rt,
> dl and sched_ext, so I'd want your/John's input first.
>
> Do you know whether blocked_on is still set there? If it is, I'd still prefer
> to take this now, since the under-count only shows up once John's series is in,
> and revisit (or adjust) then - unless you'd rather wait.
It's up to Peter to take it or not so... IDK.
Thanks,
Kayra