lkml.org 
[lkml]   [2018]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v3 09/10] sched/fair: Select an energy-efficient CPU on task wake-up
Hi,

On 21/05/18 15:25, Quentin Perret wrote:

[...]

> +static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
> +{
> + unsigned long cur_energy, prev_energy, best_energy, cpu_cap, task_util;
> + int cpu, best_energy_cpu = prev_cpu;
> + struct sched_energy_fd *sfd;
> + struct sched_domain *sd;
> +
> + sync_entity_load_avg(&p->se);
> +
> + task_util = task_util_est(p);
> + if (!task_util)
> + return prev_cpu;
> +
> + /*
> + * Energy-aware wake-up happens on the lowest sched_domain starting
> + * from sd_ea spanning over this_cpu and prev_cpu.
> + */
> + sd = rcu_dereference(*this_cpu_ptr(&sd_ea));
> + while (sd && !cpumask_test_cpu(prev_cpu, sched_domain_span(sd)))
> + sd = sd->parent;
> + if (!sd)
> + return -1;

Shouldn't this be return prev_cpu?

> +
> + if (cpumask_test_cpu(prev_cpu, &p->cpus_allowed))
> + prev_energy = best_energy = compute_energy(p, prev_cpu);
> + else
> + prev_energy = best_energy = ULONG_MAX;
> +
> + for_each_freq_domain(sfd) {
> + unsigned long spare_cap, max_spare_cap = 0;
> + int max_spare_cap_cpu = -1;
> + unsigned long util;
> +
> + /* Find the CPU with the max spare cap in the freq. dom. */

I undestand this being a heuristic to cut some overhead, but shouldn't
the model tell between packing vs. spreading?

Thanks,

-Juri

\
 
 \ /
  Last update: 2018-06-08 12:25    [W:0.152 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site