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: <e8f4f0d0-d071-e169-48c2-02081c840583@arm.com>
Date:   Fri, 9 Dec 2022 08:39:10 +0000
From:   Lukasz Luba <lukasz.luba@....com>
To:     Viresh Kumar <viresh.kumar@...aro.org>
Cc:     linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
        rafael@...nel.org, dietmar.eggemann@....com,
        vincent.guittot@...aro.org, saravanak@...gle.com,
        wusamuel@...gle.com, isaacmanjarres@...gle.com,
        kernel-team@...roid.com, juri.lelli@...hat.com,
        peterz@...radead.org, mingo@...hat.com, rostedt@...dmis.org,
        bsegall@...gle.com, mgorman@...e.de
Subject: Re: [PATCH v3 1/1] cpufreq: schedutil: Optimize operations with
 single CPU capacity lookup



On 12/8/22 23:38, Viresh Kumar wrote:
> On 08-12-22, 16:02, Lukasz Luba wrote:
>> @@ -332,12 +333,15 @@ static void sugov_update_single_freq(struct update_util_data *hook, u64 time,
>>   	struct sugov_cpu *sg_cpu = container_of(hook, struct sugov_cpu, update_util);
>>   	struct sugov_policy *sg_policy = sg_cpu->sg_policy;
>>   	unsigned int cached_freq = sg_policy->cached_raw_freq;
>> +	unsigned long max_cap;
>>   	unsigned int next_f;
>>   
>> -	if (!sugov_update_single_common(sg_cpu, time, flags))
>> +	max_cap = arch_scale_cpu_capacity(sg_cpu->cpu);
> 
> I will rather do this at all three locations:
> 
> 	unsigned long max_cap = arch_scale_cpu_capacity(sg_cpu->cpu);
> 

In the 2nd location it is called after the check:

if (!arch_scale_freq_invariant())

which can return.

IMO this is more visible and exposed.
The way it's implemented now stresses the fact that
we read this value at runtime (unfortunately). Maybe in the
future someone would find it and simplify.

I sometimes found difficult to spot those important calls in
the variable header section, e.g. how many times are called
or with what kind of arguments. In this case the sg_cpu->cpu
should be clearly visible and effectively matched as the same as
smp_procesor_id() for that running CPU, thus fetching the
same capacity variable from local per-cpu (not remote).
IMO the way how the code is structured could help (or not)
to spot those details. That's why I prefer to keep it as is
in this implementation.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ