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 include/linux (2 of 6 files). Show all
Unified · Split
| @@ -39,8 +39,8 @@ static inline unsigned long topology_get_thermal_pressure(int cpu) · 38 unmodified lines | ||
| 39 | 39 | return per_cpu(thermal_pressure, cpu); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | −void arch_set_thermal_pressure(struct cpumask *cpus, | |
| 43 | − unsigned long th_pressure); | |
| 42 | +void topology_set_thermal_pressure(const struct cpumask *cpus, | |
| 43 | + unsigned long th_pressure); | |
| 44 | 44 | |
| 45 | 45 | struct cpu_topology { |
| 46 | 46 | int thread_id; |
| @@ -232,6 +232,13 @@ unsigned long arch_scale_thermal_pressure(int cpu) · 231 unmodified lines | ||
| 232 | 232 | } |
| 233 | 233 | #endif |
| 234 | 234 | |
| 235 | +#ifndef arch_set_thermal_pressure | |
| 236 | +static __always_inline | |
| 237 | +void arch_set_thermal_pressure(const struct cpumask *cpus, | |
| 238 | + unsigned long th_pressure) | |
| 239 | +{ } | |
| 240 | +#endif | |
| 241 | + | |
| 235 | 242 | static inline int task_node(const struct task_struct *p) |
| 236 | 243 | { |
| 237 | 244 | return cpu_to_node(task_cpu(p)); |