On 08-Mar 11:06, Viresh Kumar wrote:
On 07-03-18, 12:16, Ionela Voinescu wrote:
--- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6742,7 +6742,7 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, unsigned long target_max_spare_cap = 0; unsigned long target_util = ULONG_MAX; unsigned long best_active_util = ULONG_MAX;
unsigned long target_idle_max_spare_cap = 0;
unsigned long backup_idle_max_spare_cap = 0; int best_idle_cstate = INT_MAX; struct sched_domain *sd; struct sched_group *sg;
@@ -6928,15 +6928,22 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, */ if (idle_cpu(i)) { int idle_idx = idle_get_state_idx(cpu_rq(i));
int is_min_cap_orig; /* Select idle CPU with lower cap_orig */ if (capacity_orig > best_idle_min_cap_orig) continue;
is_min_cap_orig = capacity_orig ==
best_idle_min_cap_orig;
/* Favor CPUs that won't end up running at a
* high OPP.
* high OPP, but only if their capacity is equal
* to the efficient CPUs considered. */
if ((capacity_orig - min_capped_util) <
target_idle_max_spare_cap)
if (is_min_cap_orig &&
(capacity_orig - min_capped_util) <
backup_idle_max_spare_cap) continue; /*
@@ -6945,13 +6952,14 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, * IOW, prefer a deep IDLE LITTLE CPU vs a * shallow idle big CPU. */
if (sysctl_sched_cstate_aware &&
best_idle_cstate <= idle_idx)
if (is_min_cap_orig &&
sysctl_sched_cstate_aware &&
(best_idle_cstate <= idle_idx)) continue;
This surely fixes the issue I pointed in Patrick's patch, but this adds more comparisons to this loop which makes it less efficient. And so I really wonder now if the first patch I proposed was better or this one :)
I know, you guys didn't like the goto thing, and that's fine, but we should be efficient as well.
We are actually considering to completely drop this fix by working in a different direction, which is changing the start_cpu to consider prefer_idle instead of boosted.
This will allow to simplify the heuristic and make it easy the removal of case A in favour of the mainline slow path... but there is currently one downcase, which is that of foreground apps.
Ionela is currently wltesting a patch on P2 she will follow up if it should be ok from the power / performance standpoint.
-- #include <best/regards.h>
Patrick Bellasi