Loading kernel/power/energy_model.c +5 −1 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ static struct em_perf_domain *em_create_pd(cpumask_t *span, int nr_states, */ opp_eff = freq / power; if (opp_eff >= prev_opp_eff) pr_warn("pd%d: hertz/watts ratio non-monotonically decreasing: em_cap_state %d >= em_cap_state%d\n", pr_debug("pd%d: hertz/watts ratio non-monotonically decreasing: em_cap_state %d >= em_cap_state%d\n", cpu, i, i - 1); prev_opp_eff = opp_eff; } Loading @@ -151,6 +151,10 @@ static struct em_perf_domain *em_create_pd(cpumask_t *span, int nr_states, for (i = 0; i < nr_states; i++) { table[i].cost = div64_u64(fmax * table[i].power, table[i].frequency); if (i > 0 && (table[i].cost < table[i - 1].cost) && (table[i].power > table[i - 1].power)) { table[i].cost = table[i - 1].cost; } } pd->table = table; Loading kernel/sched/fair.c +25 −0 Original line number Diff line number Diff line Loading @@ -7359,6 +7359,25 @@ static inline struct cpumask *find_rtg_target(struct task_struct *p) } #endif /* return true if cpu should be chosen over best_energy_cpu */ static inline bool select_cpu_same_energy(int cpu, int best_cpu, int prev_cpu) { if (best_cpu == prev_cpu) return false; if (idle_cpu(best_cpu) && idle_get_state_idx(cpu_rq(best_cpu)) <= 0) return false; /* best_cpu is idle wfi or shallower */ if (idle_cpu(cpu) && idle_get_state_idx(cpu_rq(cpu)) <= 0) return true; /* new cpu is idle wfi or shallower */ /* * If we are this far this must be a tie between a busy and deep idle, * pick the busy. */ return idle_cpu(best_cpu); } static DEFINE_PER_CPU(cpumask_t, energy_cpus); /* Loading Loading @@ -7507,6 +7526,12 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, int sy if (cur_energy < best_energy) { best_energy = cur_energy; best_energy_cpu = cpu; } else if (cur_energy == best_energy) { if (select_cpu_same_energy(cpu, best_energy_cpu, prev_cpu)) { best_energy = cur_energy; best_energy_cpu = cpu; } } } unlock: Loading Loading
kernel/power/energy_model.c +5 −1 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ static struct em_perf_domain *em_create_pd(cpumask_t *span, int nr_states, */ opp_eff = freq / power; if (opp_eff >= prev_opp_eff) pr_warn("pd%d: hertz/watts ratio non-monotonically decreasing: em_cap_state %d >= em_cap_state%d\n", pr_debug("pd%d: hertz/watts ratio non-monotonically decreasing: em_cap_state %d >= em_cap_state%d\n", cpu, i, i - 1); prev_opp_eff = opp_eff; } Loading @@ -151,6 +151,10 @@ static struct em_perf_domain *em_create_pd(cpumask_t *span, int nr_states, for (i = 0; i < nr_states; i++) { table[i].cost = div64_u64(fmax * table[i].power, table[i].frequency); if (i > 0 && (table[i].cost < table[i - 1].cost) && (table[i].power > table[i - 1].power)) { table[i].cost = table[i - 1].cost; } } pd->table = table; Loading
kernel/sched/fair.c +25 −0 Original line number Diff line number Diff line Loading @@ -7359,6 +7359,25 @@ static inline struct cpumask *find_rtg_target(struct task_struct *p) } #endif /* return true if cpu should be chosen over best_energy_cpu */ static inline bool select_cpu_same_energy(int cpu, int best_cpu, int prev_cpu) { if (best_cpu == prev_cpu) return false; if (idle_cpu(best_cpu) && idle_get_state_idx(cpu_rq(best_cpu)) <= 0) return false; /* best_cpu is idle wfi or shallower */ if (idle_cpu(cpu) && idle_get_state_idx(cpu_rq(cpu)) <= 0) return true; /* new cpu is idle wfi or shallower */ /* * If we are this far this must be a tie between a busy and deep idle, * pick the busy. */ return idle_cpu(best_cpu); } static DEFINE_PER_CPU(cpumask_t, energy_cpus); /* Loading Loading @@ -7507,6 +7526,12 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, int sy if (cur_energy < best_energy) { best_energy = cur_energy; best_energy_cpu = cpu; } else if (cur_energy == best_energy) { if (select_cpu_same_energy(cpu, best_energy_cpu, prev_cpu)) { best_energy = cur_energy; best_energy_cpu = cpu; } } } unlock: Loading