Re: [PATCH 12/24] sched/fair: Prepare exit/cleanup paths for delayed_dequeue
From: Peter Zijlstra
Date: Tue Aug 13 2024 - 17:54:54 EST
On Tue, Aug 13, 2024 at 02:43:47PM +0200, Valentin Schneider wrote:
> On 27/07/24 12:27, Peter Zijlstra wrote:
> > @@ -12817,10 +12830,26 @@ static void attach_task_cfs_rq(struct ta
> > static void switched_from_fair(struct rq *rq, struct task_struct *p)
> > {
> > detach_task_cfs_rq(p);
> > + /*
> > + * Since this is called after changing class, this isn't quite right.
> > + * Specifically, this causes the task to get queued in the target class
> > + * and experience a 'spurious' wakeup.
> > + *
> > + * However, since 'spurious' wakeups are harmless, this shouldn't be a
> > + * problem.
> > + */
> > + p->se.sched_delayed = 0;
> > + /*
> > + * While here, also clear the vlag, it makes little sense to carry that
> > + * over the excursion into the new class.
> > + */
> > + p->se.vlag = 0;
>
> RQ lock is held, the task can't be current if it's ->sched_delayed; is a
> dequeue_task() not possible at this point? Or just not worth it?
Hurmph, I really can't remember why I did it like this :-(
Also, I remember thinking this vlag reset might not be ideal, PI induced
class excursions might be very short and would benefit from retaining
vlag.
Let me make this something like:
if (se->sched_delayed)
dequeue_entities(rq, &p->se, DEQUEUE_SLEEP | DEQUEUE_DELAYED);