Messages in this thread | | | Date | Tue, 21 Jul 2015 16:12:23 +0100 | From | Morten Rasmussen <> | Subject | Re: [RFCv5 PATCH 31/46] sched: Consider spare cpu capacity at task wake-up |
| |
On Mon, Jul 20, 2015 at 05:37:20PM -0700, Sai Gurrappadi wrote: > Hi Morten, > > On 07/07/2015 11:24 AM, Morten Rasmussen wrote:
[...]
> > @@ -5290,6 +5291,16 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, > > fit_capacity = capacity_of(i); > > fit_group = group; > > } > > + > > + /* > > + * Look for group which has most spare capacity on a > > + * single cpu. > > + */ > > + spare_capacity = capacity_of(i) - get_cpu_usage(i); > > + if (spare_capacity > max_spare_capacity) { > > + max_spare_capacity = spare_capacity; > > + spare_group = group; > > + } > > Another minor buglet: get_cpu_usage(i) here could be > capacity_of(i) > because usage is bounded by capacity_orig_of(i). Should it be bounded by > capacity_of() instead?
Yes, that code is clearly broken. For this use of get_cpu_usage() it makes more sense to cap it by capacity_of(). However, I think we actually need two versions of get_cpu_usage(): One that reports CFS utilization which as capped by CFS capacity (capacity_of()), and one that reports total utilization (all sched_classes and IRQ) which is capped by capacity_orig_of(). The former for use in CFS scheduling decisions like the one above, and the latter for energy estimates and selecting DVFS frequencies where we should include all utilization, not just CFS tasks.
I will fix get_cpu_usage() as you propose.
Thanks, Morten
| |