Skip to content

Commit

Permalink
sched/fair: Move call to list_last_entry() in detach_tasks
Browse files Browse the repository at this point in the history
Move the call to list_last_entry() in detach_tasks() after testing
loop_max and loop_break.

Signed-off-by: Vincent Guittot <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
  • Loading branch information
vingu-linaro authored and Peter Zijlstra committed Sep 15, 2022
1 parent c59862f commit 7e9518b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -8044,8 +8044,6 @@ static int detach_tasks(struct lb_env *env)
if (env->idle != CPU_NOT_IDLE && env->src_rq->nr_running <= 1)
break;

p = list_last_entry(tasks, struct task_struct, se.group_node);

env->loop++;
/*
* We've more or less seen every task there is, call it quits
Expand All @@ -8062,6 +8060,8 @@ static int detach_tasks(struct lb_env *env)
break;
}

p = list_last_entry(tasks, struct task_struct, se.group_node);

if (!can_migrate_task(p, env))
goto next;

Expand Down

0 comments on commit 7e9518b

Please sign in to comment.