lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <251b524a-2c44-3892-1bae-03f879d6a64b@arm.com>
Date:   Fri, 12 May 2023 16:39:51 +0200
From:   Dietmar Eggemann <dietmar.eggemann@....com>
To:     Peter Zijlstra <peterz@...radead.org>
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 12/05/2023 13:22, Peter Zijlstra wrote:
> 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));

I need the util_est = max(util_est, runnable) further down as well. Just
want to fetch runnable only once.

util = 50, task_util = 5, util_est = 60, task_util_est = 10, runnable = 70

max(70 + 5, 60 + 10) != max (70 + 5, 70 + 10) when dst_cpu == cpu

>> @@ -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?

Yes, will move it.

>> -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?

Yes, will change it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ