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
3939 return per_cpu(thermal_pressure, cpu);
4040 }
4141
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);
4444
4545 struct cpu_topology {
4646 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
232232 }
233233 #endif
234234
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+
235242 static inline int task_node(const struct task_struct *p)
236243 {
237244 return cpu_to_node(task_cpu(p));