sched: ems: service: Fix service CPU selection algorithm
1. Consider boosted task utilization when choosing/considering maximum spare capacity 2. Take advantage of CPU cstates 3. Account of task utilization to avoid overutilizing a CPU Signed-off-by: Diep Quynh <remilia.1505@gmail.com>
This commit is contained in:
parent
18a9c42851
commit
8a2aace408
1 changed files with 13 additions and 7 deletions
|
@ -106,6 +106,7 @@ select_prefer_cpu(struct task_struct *p, int coregroup_count, struct cpumask *pr
|
|||
struct cpumask mask;
|
||||
int coregroup, cpu;
|
||||
unsigned long max_spare_cap = 0;
|
||||
unsigned long min_idle_util = ULONG_MAX;
|
||||
int best_perf_cstate = INT_MAX;
|
||||
int best_perf_cpu = -1;
|
||||
int backup_cpu = -1;
|
||||
|
@ -118,28 +119,33 @@ select_prefer_cpu(struct task_struct *p, int coregroup_count, struct cpumask *pr
|
|||
continue;
|
||||
|
||||
for_each_cpu_and(cpu, &p->cpus_allowed, &mask) {
|
||||
unsigned long capacity_orig;
|
||||
unsigned long wake_util;
|
||||
unsigned long capacity_orig = capacity_orig_of(cpu);
|
||||
unsigned long new_util = cpu_util_wake(cpu, p) + task_util_est(p);
|
||||
|
||||
new_util = max(new_util, boosted_task_util(p));
|
||||
if (new_util > capacity_orig)
|
||||
continue;
|
||||
|
||||
if (idle_cpu(cpu)) {
|
||||
int idle_idx = idle_get_state_idx(cpu_rq(cpu));
|
||||
|
||||
/* find shallowest idle state cpu */
|
||||
if (idle_idx >= best_perf_cstate)
|
||||
if (idle_idx > best_perf_cstate ||
|
||||
(idle_idx == best_perf_cstate &&
|
||||
new_util >= min_idle_util))
|
||||
continue;
|
||||
|
||||
/* Keep track of best idle CPU */
|
||||
min_idle_util = new_util;
|
||||
best_perf_cstate = idle_idx;
|
||||
best_perf_cpu = cpu;
|
||||
continue;
|
||||
}
|
||||
|
||||
capacity_orig = capacity_orig_of(cpu);
|
||||
wake_util = cpu_util_wake(cpu, p);
|
||||
if ((capacity_orig - wake_util) < max_spare_cap)
|
||||
if ((capacity_orig - new_util) < max_spare_cap)
|
||||
continue;
|
||||
|
||||
max_spare_cap = capacity_orig - wake_util;
|
||||
max_spare_cap = capacity_orig - new_util;
|
||||
backup_cpu = cpu;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue