[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230512112229.GW4253@hirez.programming.kicks-ass.net>
Date: Fri, 12 May 2023 13:22:29 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Dietmar Eggemann <dietmar.eggemann@....com>
Cc: Ingo Molnar <mingo@...nel.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Qais Yousef <qyousef@...alina.io>,
Kajetan Puchalski <kajetan.puchalski@....com>,
Morten Rasmussen <morten.rasmussen@....com>,
Vincent Donnefort <vdonnefort@...gle.com>,
Quentin Perret <qperret@...gle.com>,
Abhijeet Dharmapurikar <adharmap@...cinc.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] sched/fair, cpufreq: Introduce 'runnable boosting'
On Fri, May 12, 2023 at 12:10:29PM +0200, Dietmar Eggemann wrote:
> -static unsigned long cpu_util(int cpu, struct task_struct *p, int dst_cpu)
> +static unsigned long
> +cpu_util(int cpu, struct task_struct *p, int dst_cpu, int boost)
> {
> struct cfs_rq *cfs_rq = &cpu_rq(cpu)->cfs;
> unsigned long util = READ_ONCE(cfs_rq->avg.util_avg);
> + unsigned long runnable;
> +
> + runnable = boost ? READ_ONCE(cfs_rq->avg.runnable_avg) : 0;
> + util = max(util, runnable);
>
if (boost)
util = max(util, READ_ONCE(cfs_rq->avg.runnable_avg));
> @@ -7239,9 +7246,9 @@ static unsigned long cpu_util(int cpu, struct task_struct *p, int dst_cpu)
> *
> * Return: (Estimated) utilization for the specified CPU.
> */
Given that cpu_util() is the base function should this comment move
there?
> -unsigned long cpu_util_cfs(int cpu)
> +unsigned long cpu_util_cfs(int cpu, int boost)
> {
> - return cpu_util(cpu, NULL, -1);
> + return cpu_util(cpu, NULL, -1, boost);
> }
AFAICT the @boost argument is always a constant (0 or 1). Would it not
make more sense to simply add:
unsigned long cpu_util_cfs_boost(int cpu)
{
return cpu_util(cpu, NULL, -1, 1);
}
and use that in the few sites that actually need it?
Powered by blists - more mailing lists