Messages in this thread | | | Date | Wed, 18 Apr 2018 08:57:43 +0100 | From | Quentin Perret <> | Subject | Re: [RFC PATCH v2 5/6] sched/fair: Select an energy-efficient CPU on task wake-up |
| |
Hi Leo,
On Tuesday 17 Apr 2018 at 23:39:44 (+0800), Leo Yan wrote: > > + for_each_freq_domain(fd) { > > + 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. */ > > + for_each_cpu_and(cpu, freq_domain_span(fd), sched_domain_span(sd)) { > > + if (!cpumask_test_cpu(cpu, &p->cpus_allowed)) > > + continue; > > + > > + if (cpu == prev_cpu) > > + continue; > > + > > + util = cpu_util_wake(cpu, p); > > + cpu_cap = capacity_of(cpu); > > + if (!util_fits_capacity(util + task_util, cpu_cap)) > > + continue; > > + > > + spare_cap = cpu_cap - util; > > + if (spare_cap > max_spare_cap) { > > + max_spare_cap = spare_cap; > > + max_spare_cap_cpu = cpu; > > + } > > + } > > If have two clusters, and if firstly iterate the big cluster, then > max_spare_cap is a big value for big cluster and later LITTLE cluster > has no chance to have higher value for spare_cap. For this case, the > LITTLE CPU will be skipped for energy computation?
max_spare_cap is reset to 0 at the top of the for_each_freq_domain() loop above so that shouldn't happen.
Thanks, Quentin
| |