[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240703114623.g7damgahld47kiah@airbuntu>
Date: Wed, 3 Jul 2024 12:46:23 +0100
From: Qais Yousef <qyousef@...alina.io>
To: Xuewen Yan <xuewen.yan94@...il.com>
Cc: Xuewen Yan <xuewen.yan@...soc.com>, vincent.guittot@...aro.org,
dietmar.eggemann@....com, mingo@...hat.com, peterz@...radead.org,
juri.lelli@...hat.com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
christian.loehle@....com, vincent.donnefort@....com,
ke.wang@...soc.com, di.shen@...soc.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 2/2] sched/fair: Use actual_cpu_capacity everywhere in
util_fits_cpu()
On 07/01/24 20:13, Xuewen Yan wrote:
> > > *
> > > * Only exception is for HW or cpufreq pressure since it has a direct impact
> > > * on available OPP of the system.
> > > @@ -5011,7 +5011,7 @@ static inline int util_fits_cpu(unsigned long util,
> > > * For uclamp_max, we can tolerate a drop in performance level as the
> > > * goal is to cap the task. So it's okay if it's getting less.
> > > */
> > > - capacity_orig = arch_scale_cpu_capacity(cpu);
> > > + capacity_actual = get_actual_cpu_capacity(cpu);
> > >
> > > /*
> > > * We want to force a task to fit a cpu as implied by uclamp_max.
> > > @@ -5039,7 +5039,7 @@ static inline int util_fits_cpu(unsigned long util,
> > > * uclamp_max request.
> > > *
> > > * which is what we're enforcing here. A task always fits if
> > > - * uclamp_max <= capacity_orig. But when uclamp_max > capacity_orig,
> > > + * uclamp_max <= capacity_actual. But when uclamp_max > capacity_actual,
> > > * the normal upmigration rules should withhold still.
> > > *
> > > * Only exception is when we are on max capacity, then we need to be
> > > @@ -5050,8 +5050,8 @@ static inline int util_fits_cpu(unsigned long util,
> > > * 2. The system is being saturated when we're operating near
> > > * max capacity, it doesn't make sense to block overutilized.
> > > */
> > > - uclamp_max_fits = (capacity_orig == SCHED_CAPACITY_SCALE) && (uclamp_max == SCHED_CAPACITY_SCALE);
> > > - uclamp_max_fits = !uclamp_max_fits && (uclamp_max <= capacity_orig);
> > > + uclamp_max_fits = (capacity_actual == SCHED_CAPACITY_SCALE) && (uclamp_max == SCHED_CAPACITY_SCALE);
> >
> > We should use capacity_orig here. We are checking if the CPU is the max
> > capacity CPU.
>
> Maybe we could remove the uclamp_max_fits = (capacity_orig ==
> SCHED_CAPACITY_SCALE) && (uclamp_max == SCHED_CAPACITY_SCALE);
> and just judge the uclamp_max <= capacity_actual?
>
> - uclamp_max_fits = (capacity_orig == SCHED_CAPACITY_SCALE) &&
> (uclamp_max == SCHED_CAPACITY_SCALE);
> - uclamp_max_fits = !uclamp_max_fits && (uclamp_max <= capacity_orig);
> + uclamp_max_fits = (uclamp_max <= capacity_actual);
If capacity_orig = 1024, capacity_actual = 1024, uclamp_max = 1024 (which is
the common case), then overutilized will never trigger for big CPU, no?
We can't 'force' fit a task on the biggest core, and fits_capacity() should be
our sole judge here if we fit or not.
Powered by blists - more mailing lists