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

From: Vincent Guittot
Date: Thu Feb 20 2020 - 04:38:17 EST


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

>
> Signed-off-by: chenqiwu <chenqiwu@xxxxxxxxxx>
> ---
> kernel/sched/fair.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 3c8a379..945dcaf 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5341,6 +5341,8 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
> bool was_sched_idle = sched_idle_rq(rq);
>
> for_each_sched_entity(se) {
> + if (!se->on_rq)
> + break;
> cfs_rq = cfs_rq_of(se);
> dequeue_entity(cfs_rq, se, flags);
>
> --
> 1.9.1
>