[COMMON] sched/fair: Fix hang during rebuilding sd in compute_energy.
authorJohnlay Park <jonglae.park@samsung.com>
Mon, 19 Feb 2018 05:51:23 +0000 (14:51 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:35:57 +0000 (17:35 +0900)
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 <jonglae.park@samsung.com>
kernel/sched/fair.c

index ddbf7eeefcc0d9d0cb0cafcea04d7bf48367af39..bc6ce0bc170e64ae198310bc55a88dc908aab082 100644 (file)
@@ -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;
        }