Re: [RFC PATCH 1/2] thermal/cpufreq_cooling: remove unused cpu_idx in get_load()

From: Lukasz Luba

Date: Mon Mar 23 2026 - 06:58:12 EST




On 3/23/26 10:41, Viresh Kumar wrote:
On 23-03-26, 09:20, Lukasz Luba wrote:
Thanks for monitoring the development (it's always good
to have extra engineer opinion)!

I've checked the commit that you referred to and the 'i++' there.
It's safe. That commit removed the heavy operation for only
tracing purpose, namely:
- allocate buffer for N CPUs for 'load_cpu' pointer
- populate CPUs' load from the idle fwk
- put that info into the trace
- free the 'load_cpu' buffer

That has been redesigned since it was just for tracing
and introducing extra time spent for code run in the
throttling phase.

The code in get_load() is OK with the commit that you
mentioned.

The code

load = get_load(cpufreq_cdev, cpu, i);

depends on `i` being incremented in the loop to get the correct
`cpu_idx`. But the said commit removed it and left `i` to be set to 0
for ever.

How is that okay ? What am I missing ?


Right, there is a mix of two things.
The 'i' left but should be removed as well, since
this is !SMP code with only 1 cpu and i=0.

The whole split which has been made for getting
the load or utilization from CPU(s) needs to be
cleaned. The compiled code looks different since
it knows there is non-SMP config used.

Do you want to clean that or I should do this?