Skip to content

Commit b28bc1e

Browse files
Qais Yousefingomolnar
authored andcommitted
sched/rt: Re-instate old behavior in select_task_rq_rt()
When RT Capacity Aware support was added, the logic in select_task_rq_rt was modified to force a search for a fitting CPU if the task currently doesn't run on one. But if the search failed, and the search was only triggered to fulfill the fitness request; we could end up selecting a new CPU unnecessarily. Fix this and re-instate the original behavior by ensuring we bail out in that case. This behavior change only affected asymmetric systems that are using util_clamp to implement capacity aware. None asymmetric systems weren't affected. LINK: https://lore.kernel.org/lkml/20200218041620.GD28029@codeaurora.org/ Reported-by: Pavan Kondeti <pkondeti@codeaurora.org> Signed-off-by: Qais Yousef <qais.yousef@arm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Fixes: 804d402 ("sched/rt: Make RT capacity-aware") Link: https://lkml.kernel.org/r/20200302132721.8353-3-qais.yousef@arm.com
1 parent d9cb236 commit b28bc1e

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎kernel/sched/rt.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,13 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)
14741474
if (test || !rt_task_fits_capacity(p, cpu)) {
14751475
int target = find_lowest_rq(p);
14761476

1477+
/*
1478+
* Bail out if we were forcing a migration to find a better
1479+
* fitting CPU but our search failed.
1480+
*/
1481+
if (!test && target != -1 && !rt_task_fits_capacity(p, target))
1482+
goto out_unlock;
1483+
14771484
/*
14781485
* Don't bother moving it if the destination CPU is
14791486
* not running a lower priority task.
@@ -1482,6 +1489,8 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)
14821489
p->prio < cpu_rq(target)->rt.highest_prio.curr)
14831490
cpu = target;
14841491
}
1492+
1493+
out_unlock:
14851494
rcu_read_unlock();
14861495

14871496
out:

0 commit comments

Comments
 (0)