From: Johnlay Park Date: Mon, 19 Feb 2018 05:51:23 +0000 (+0900) Subject: [COMMON] sched/fair: Fix hang during rebuilding sd in compute_energy. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9afacaea65f3e0140cef59bdb643aad147748b22;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] sched/fair: Fix hang during rebuilding sd in compute_energy. This patch implemtes the hotplug race check differently and should therefore reinstate support for per-cpu capacity states. refer the commit d5f2ca8a4778938c45d679d67c45b256114de3c5, 64f6fd103dadaf762d3dc11173c5544ff6ec1b16. Change-Id: Iab48cf63c3672e10ad8230d1eeb09185ea588022 Signed-off-by: Johnlay Park --- diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ddbf7eeefcc0..bc6ce0bc170e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5867,7 +5867,17 @@ static int compute_energy(struct energy_env *eenv) } while (sg = sg->next, sg != sd->groups); } + + /* + * If we raced with hotplug and got an sd NULL-pointer; + * returning a wrong energy estimation is better than + * entering an infinite loop. + */ + if (cpumask_test_cpu(cpu, &visit_cpus)) + return -EINVAL; + next_cpu: + cpumask_clear_cpu(cpu, &visit_cpus); continue; }