The following commit: 14533a16c46d ("thermal/cpu-cooling, sched/core: Move the arch_set_thermal_pressure() API to generic scheduler code") moved the definition of arch_set_thermal_pressure() to sched/core.c, but kept its declaration in linux/arch_topology.h. When building e.g. an x86 kernel with CONFIG_SCHED_THERMAL_PRESSURE=y, cpufreq_cooling.c ends up getting the declaration of arch_set_thermal_pressure() from include/linux/arch_topology.h, which is somewhat awkward. On top of this, sched/core.c unconditionally defines o The thermal_pressure percpu variable o arch_set_thermal_pressure() while arch_scale_thermal_pressure() does nothing unless redefined by the architecture. arch_*() functions are meant to be defined by architectures, so revert the aforementioned commit and re-implement it in a way that keeps arch_set_thermal_pressure() architecture-definable, and doesn't define the thermal pressure percpu variable for kernels that don't need it (CONFIG_SCHED_THERMAL_PRESSURE=n).
Showing the changes to kernel (1 of 6 files). Show all
Unified · Split
| @@ -3869,17 +3869,6 @@ unsigned long long task_sched_runtime(struct task_struct *p) · 3868 unmodified lines | |||
| 3869 | return ns; | 3869 | return ns; |
| 3870 | } | 3870 | } |
| 3871 | 3871 | ||
| 3872 | DEFINE_PER_CPU(unsigned long, thermal_pressure); | ||
| 3873 | |||
| 3874 | void arch_set_thermal_pressure(struct cpumask *cpus, | ||
| 3875 | unsigned long th_pressure) | ||
| 3876 | { | ||
| 3877 | int cpu; | ||
| 3878 | |||
| 3879 | for_each_cpu(cpu, cpus) | ||
| 3880 | WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure); | ||
| 3881 | } | ||
| 3882 | |||
| 3883 | /* | 3872 | /* |
| 3884 | * This function gets called by the timer code, with HZ frequency. | 3873 | * This function gets called by the timer code, with HZ frequency. |
| 3885 | * We call it with interrupts disabled. | 3874 | * We call it with interrupts disabled. |