Messages in this thread | | | From | Valentin Schneider <> | Subject | Re: [PATCH v2 1/9] sched/uclamp: Fix relationship between uclamp and migration margin | Date | Fri, 04 Nov 2022 17:35:33 +0000 |
| |
I'm only seeing this now that it has hit tip/sched/core and I've had a stroll through fair.c, apologies for this being late.
On 04/08/22 15:36, Qais Yousef wrote: > +static inline int util_fits_cpu(unsigned long util, > + unsigned long uclamp_min, > + unsigned long uclamp_max, > + int cpu) > +{ > + unsigned long capacity_orig, capacity_orig_thermal; > + unsigned long capacity = capacity_of(cpu); > + bool fits, uclamp_max_fits; > + > + /* > + * Check if the real util fits without any uclamp boost/cap applied. > + */ > + fits = fits_capacity(util, capacity); > + > + if (!uclamp_is_used()) > + return fits; > + > + /* > + * We must use capacity_orig_of() for comparing against uclamp_min and > + * uclamp_max. We only care about capacity pressure (by using > + * capacity_of()) for comparing against the real util. > + * > + * If a task is boosted to 1024 for example, we don't want a tiny > + * pressure to skew the check whether it fits a CPU or not. > + * > + * Similarly if a task is capped to capacity_orig_of(little_cpu), it > + * should fit a little cpu even if there's some pressure. > + * > + * Only exception is for thermal pressure since it has a direct impact > + * on available OPP of the system. > + * > + * We honour it for uclamp_min only as a drop in performance level > + * could result in not getting the requested minimum performance level. > + *
Why specifically care about OPPs here? Per our CPU capacity model, a task alone on a CPUx throttled to f=fmax/2 and a task coscheduled on a CPUy with RT/DL tasks and/or IRQs such that cpu_capacity(CPUy) = 50% are both getting (roughly) the same performance level.
| |