History

arch_topology, sched/core: Cleanup thermal pressure definition

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).

Valentin Schneider committed 6 years ago

Commit 25980c71 parent 27059376 files · +24 −15Browse files

Showing the changes to include/linux (2 of 6 files). Show all

Unified · Split

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