lkml.org 
[lkml]   [2021]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 1/5] arch_topology: Introduce thermal pressure update function
From
Date


On 10/28/21 6:44 AM, Viresh Kumar wrote:
> On 15-10-21, 15:45, Lukasz Luba wrote:
>> +/**
>> + * topology_thermal_pressure_update() - Update thermal pressure for CPUs
>> + * @cpus : The related CPUs for which capacity has been reduced
>> + * @capped_freq : The maximum allowed frequency that CPUs can run at
>
> Maybe replace tabs with spaces here ?

Sure

>
>> + *
>> + * Update the value of thermal pressure for all @cpus in the mask. The
>> + * cpumask should include all (online+offline) affected CPUs, to avoid
>> + * operating on stale data when hot-plug is used for some CPUs. The
>> + * @capped_freq must be less or equal to the max possible frequency and
>> + * reflects the currently allowed max CPUs frequency due to thermal capping.
>> + * The @capped_freq must be provided in kHz.
>> + */
>> +void topology_thermal_pressure_update(const struct cpumask *cpus,
>> + unsigned long capped_freq)
>> +{
>> + unsigned long max_capacity, capacity;
>> + int cpu;
>> +
>> + if (!cpus)
>
> I will drop this and let the kernel crash :)

OK :)

>
>> + return;
>> +
>> + cpu = cpumask_first(cpus);
>> + max_capacity = arch_scale_cpu_capacity(cpu);
>> +
>> + /* Convert to MHz scale which is used in 'freq_factor' */
>> + capped_freq /= 1000;
>
> We should make sure capped_freq > freq_factor and WARN if not. This will also
> get rid of similar checks at the users.

OK, I'll change that.

Thank you for the review.

Regards,
Lukasz

\
 
 \ /
  Last update: 2021-10-28 09:20    [W:0.084 / U:1.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site