Re: [PATCH] sched/fair: add !se->on_rq check before dequeue entity

From: Vincent Guittot
Date: Thu Feb 20 2020 - 07:15:36 EST


On Thu, 20 Feb 2020 at 11:31, Vincent Guittot
<vincent.guittot@xxxxxxxxxx> wrote:
>
> On Thu, 20 Feb 2020 at 11:09, chenqiwu <qiwuchen55@xxxxxxxxx> wrote:
> >
> > On Thu, Feb 20, 2020 at 10:38:02AM +0100, Vincent Guittot wrote:
> > > On Thu, 20 Feb 2020 at 08:29, <qiwuchen55@xxxxxxxxx> wrote:
> > > >
> > > > From: chenqiwu <chenqiwu@xxxxxxxxxx>
> > > >
> > > > We igonre checking for !se->on_rq condition before dequeue one
> > > > entity from cfs rq. It must be required in case the entity has
> > > > been dequeued.
> > >
> > > Do you have a use case that triggers this situation ?
> > >
> > > This is the only way to reach this situation seems to be dequeuing a
> > > task on a throttled cfs_rq
> > >
> > Sorry, I have no use case triggers this situation. It's just found by
> > reading code.
> > I agree the situation you mentioned above may have a racy with
> > dequeue_task_fair() in the following code path:
> > __schedule
> > pick_next_task_fair
> > put_prev_entity
> > check_cfs_rq_runtime
> > throttle_cfs_rq
> > dequeue_entity
> >
> > So this check is worth to be added for dequeue_task_fair().
>
> In fact the check is already done thanks to the: if (cfs_rq_throttled(cfs_rq))
> AFAICT, there is no other way to enqueue a task on a cfs_rq for which
> the group entity is not enqueued

Hmm i have been too quick in my reply. I wanted to say:
AFAICT, there is no other way to dequeue a task from a cfs_rq for
which the group entity is not enqueued