sched/fair: Return previous CPU when perf domains are not available
find_energy_efficient_cpu() returns -1 when perf domains are not
available. The perf domains are not accessible for a short duration,
when sched domains are rebuilt during CPU hotplug. Handle this
scenario by returning previous CPU instead of -1. The select_task_rq()
handles the case where the previous CPU is not eligible to run the
waking task, so no additional checks are needed.
At present it is not resulting in an incorrect memory access, because
select_task_rq() -> is_cpu_allowed() -> cpumask_test_cpu() interprets
-1 as all 1s and evaluate that the task can't run on it and forces
the fallback CPU selection. This can be caught by enabling
DEBUG_PER_CPU_MAPS debug config which prints a one time warning
when the cpu passed to a cpumask operation is invalid.
Change-Id: Ie31435f06f54236ac8b9ef278a8e1c361cf2f06a
Signed-off-by:
Pavankumar Kondeti <pkondeti@codeaurora.org>
Loading
Please register or sign in to comment