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

From: chenqiwu
Date: Thu Feb 20 2020 - 05:09:20 EST


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().