core_ctl: Fix an issue where CPUs are left un-isolated for long time
When SCHED_CORE_ROTATE config is enabled, the CPUs that are
eligible for isolation are kept rotated for every system
suspend and resume cycle. cluster->set_cur holds this eligible
mask. It is also reconfigured when min_cpus tunable is changed.
The CPUs that are part of this eligible mask are only isolated
in try_to_isolate(). A CPU that is part of this mask but is busy
at that time left isolated. Since the new need is same as the
last need, eval_need() does not kick core_ctl thread next time
when the CPU becomes idle. To fix this issue, kick the core_ctl
thread when there more active CPUs than currently needed. The kicks
are rate limited by an existing tunable called offline_delay_ms.
Change-Id: I9d3815c6c6bede4b93a708ae6edb15f94d296399
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
diff --git a/kernel/sched/core_ctl.c b/kernel/sched/core_ctl.c
index c0a8a2a..26c9cf4 100644
--- a/kernel/sched/core_ctl.c
+++ b/kernel/sched/core_ctl.c
@@ -588,7 +588,12 @@
if (new_need > cluster->active_cpus) {
ret = 1;
} else {
- if (new_need == last_need) {
+ /*
+ * When there is no change in need and there are no more
+ * active CPUs than currently needed, just update the
+ * need time stamp and return.
+ */
+ if (new_need == last_need && new_need == cluster->active_cpus) {
cluster->need_ts = now;
spin_unlock_irqrestore(&state_lock, flags);
return 0;