Re: [PATCH 3/3] sched/core: Indicate a sched_delayed task was migrated before wakeup

From: Johannes Weiner
Date: Thu Oct 10 2024 - 09:03:47 EST


Hi Prateek,

patches 1 and 2 make obvious sense to me.

On Thu, Oct 10, 2024 at 08:28:38AM +0000, K Prateek Nayak wrote:
> @@ -129,6 +129,13 @@ static inline void psi_enqueue(struct task_struct *p, bool wakeup)
> if (static_branch_likely(&psi_disabled))
> return;
>
> + /*
> + * Delayed task is not ready to run yet!
> + * Wait for a requeue before accounting.
> + */
> + if (p->se.sched_delayed)
> + return;

This one is problematic. It clears sleeping state (memstall, iowait)
during the dequeue of the migration but doesn't restore it until the
wakeup, which could presumably be much later. This leaves a gap in the
accounting.

psi really wants the dequeue and enqueue of the migration, even when a
task is delay-dequeued. We just have to get the context parsing right
to not confuse migration queues with wakeups.

I'll try to come up with a suitable solution as well, please don't
apply this one for now.