OSDN Git Service

sched/rt: cpupri_find: Implement fallback mechanism for !fit case
authorQais Yousef <qais.yousef@arm.com>
Mon, 2 Mar 2020 13:27:16 +0000 (13:27 +0000)
committerIngo Molnar <mingo@kernel.org>
Fri, 6 Mar 2020 11:57:26 +0000 (12:57 +0100)
commitd9cb236b9429044dc694ea70a50163ddd283cea6
tree388555f2d64b07f18a53d7f4116f6c72897f1c86
parent5ab297bab984310267734dfbcc8104566658ebef
sched/rt: cpupri_find: Implement fallback mechanism for !fit case

When searching for the best lowest_mask with a fitness_fn passed, make
sure we record the lowest_level that returns a valid lowest_mask so that
we can use that as a fallback in case we fail to find a fitting CPU at
all levels.

The intention in the original patch was not to allow a down migration to
unfitting CPU. But this missed the case where we are already running on
unfitting one.

With this change now RT tasks can still move between unfitting CPUs when
they're already running on such CPU.

And as Steve suggested; to adhere to the strict priority rules of RT, if
a task is already running on a fitting CPU but due to priority it can't
run on it, allow it to downmigrate to unfitting CPU so it can run.

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: 804d402fb6f6 ("sched/rt: Make RT capacity-aware")
Link: https://lkml.kernel.org/r/20200302132721.8353-2-qais.yousef@arm.com
Link: https://lore.kernel.org/lkml/20200203142712.a7yvlyo2y3le5cpn@e107158-lin/
kernel/sched/cpupri.c