Skip to content

Commit d4dbc99

Browse files
vingu-linaroIngo Molnar
authored andcommitted
sched/cpufreq: Rename arch_update_thermal_pressure() => arch_update_hw_pressure()
Now that cpufreq provides a pressure value to the scheduler, rename arch_update_thermal_pressure into HW pressure to reflect that it returns a pressure applied by HW (i.e. with a high frequency change) and not always related to thermal mitigation but also generated by max current limitation as an example. Such high frequency signal needs filtering to be smoothed and provide an value that reflects the average available capacity into the scheduler time scale. Signed-off-by: Vincent Guittot <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Tested-by: Lukasz Luba <[email protected]> Reviewed-by: Qais Yousef <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c281afe commit d4dbc99

File tree

14 files changed

+77
-77
lines changed

14 files changed

+77
-77
lines changed

arch/arm/include/asm/topology.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
/* Enable topology flag updates */
2323
#define arch_update_cpu_topology topology_update_cpu_topology
2424

25-
/* Replace task scheduler's default thermal pressure API */
26-
#define arch_scale_thermal_pressure topology_get_thermal_pressure
27-
#define arch_update_thermal_pressure topology_update_thermal_pressure
25+
/* Replace task scheduler's default HW pressure API */
26+
#define arch_scale_hw_pressure topology_get_hw_pressure
27+
#define arch_update_hw_pressure topology_update_hw_pressure
2828

2929
#else
3030

arch/arm64/include/asm/topology.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ void update_freq_counters_refs(void);
3535
/* Enable topology flag updates */
3636
#define arch_update_cpu_topology topology_update_cpu_topology
3737

38-
/* Replace task scheduler's default thermal pressure API */
39-
#define arch_scale_thermal_pressure topology_get_thermal_pressure
40-
#define arch_update_thermal_pressure topology_update_thermal_pressure
38+
/* Replace task scheduler's default HW pressure API */
39+
#define arch_scale_hw_pressure topology_get_hw_pressure
40+
#define arch_update_hw_pressure topology_update_hw_pressure
4141

4242
#include <asm-generic/topology.h>
4343

drivers/base/arch_topology.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <linux/units.h>
2323

2424
#define CREATE_TRACE_POINTS
25-
#include <trace/events/thermal_pressure.h>
25+
#include <trace/events/hw_pressure.h>
2626

2727
static DEFINE_PER_CPU(struct scale_freq_data __rcu *, sft_data);
2828
static struct cpumask scale_freq_counters_mask;
@@ -160,26 +160,26 @@ void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity)
160160
per_cpu(cpu_scale, cpu) = capacity;
161161
}
162162

163-
DEFINE_PER_CPU(unsigned long, thermal_pressure);
163+
DEFINE_PER_CPU(unsigned long, hw_pressure);
164164

165165
/**
166-
* topology_update_thermal_pressure() - Update thermal pressure for CPUs
166+
* topology_update_hw_pressure() - Update HW pressure for CPUs
167167
* @cpus : The related CPUs for which capacity has been reduced
168168
* @capped_freq : The maximum allowed frequency that CPUs can run at
169169
*
170-
* Update the value of thermal pressure for all @cpus in the mask. The
170+
* Update the value of HW pressure for all @cpus in the mask. The
171171
* cpumask should include all (online+offline) affected CPUs, to avoid
172172
* operating on stale data when hot-plug is used for some CPUs. The
173173
* @capped_freq reflects the currently allowed max CPUs frequency due to
174-
* thermal capping. It might be also a boost frequency value, which is bigger
174+
* HW capping. It might be also a boost frequency value, which is bigger
175175
* than the internal 'capacity_freq_ref' max frequency. In such case the
176176
* pressure value should simply be removed, since this is an indication that
177-
* there is no thermal throttling. The @capped_freq must be provided in kHz.
177+
* there is no HW throttling. The @capped_freq must be provided in kHz.
178178
*/
179-
void topology_update_thermal_pressure(const struct cpumask *cpus,
179+
void topology_update_hw_pressure(const struct cpumask *cpus,
180180
unsigned long capped_freq)
181181
{
182-
unsigned long max_capacity, capacity, th_pressure;
182+
unsigned long max_capacity, capacity, hw_pressure;
183183
u32 max_freq;
184184
int cpu;
185185

@@ -189,21 +189,21 @@ void topology_update_thermal_pressure(const struct cpumask *cpus,
189189

190190
/*
191191
* Handle properly the boost frequencies, which should simply clean
192-
* the thermal pressure value.
192+
* the HW pressure value.
193193
*/
194194
if (max_freq <= capped_freq)
195195
capacity = max_capacity;
196196
else
197197
capacity = mult_frac(max_capacity, capped_freq, max_freq);
198198

199-
th_pressure = max_capacity - capacity;
199+
hw_pressure = max_capacity - capacity;
200200

201-
trace_thermal_pressure_update(cpu, th_pressure);
201+
trace_hw_pressure_update(cpu, hw_pressure);
202202

203203
for_each_cpu(cpu, cpus)
204-
WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure);
204+
WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
205205
}
206-
EXPORT_SYMBOL_GPL(topology_update_thermal_pressure);
206+
EXPORT_SYMBOL_GPL(topology_update_hw_pressure);
207207

208208
static ssize_t cpu_capacity_show(struct device *dev,
209209
struct device_attribute *attr,

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
347347

348348
throttled_freq = freq_hz / HZ_PER_KHZ;
349349

350-
/* Update thermal pressure (the boost frequencies are accepted) */
351-
arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
350+
/* Update HW pressure (the boost frequencies are accepted) */
351+
arch_update_hw_pressure(policy->related_cpus, throttled_freq);
352352

353353
/*
354354
* In the unlikely case policy is unregistered do not enable

include/linux/arch_topology.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ void topology_scale_freq_tick(void);
6060
void topology_set_scale_freq_source(struct scale_freq_data *data, const struct cpumask *cpus);
6161
void topology_clear_scale_freq_source(enum scale_freq_source source, const struct cpumask *cpus);
6262

63-
DECLARE_PER_CPU(unsigned long, thermal_pressure);
63+
DECLARE_PER_CPU(unsigned long, hw_pressure);
6464

65-
static inline unsigned long topology_get_thermal_pressure(int cpu)
65+
static inline unsigned long topology_get_hw_pressure(int cpu)
6666
{
67-
return per_cpu(thermal_pressure, cpu);
67+
return per_cpu(hw_pressure, cpu);
6868
}
6969

70-
void topology_update_thermal_pressure(const struct cpumask *cpus,
70+
void topology_update_hw_pressure(const struct cpumask *cpus,
7171
unsigned long capped_freq);
7272

7373
struct cpu_topology {

include/linux/sched/topology.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,17 +270,17 @@ unsigned long arch_scale_cpu_capacity(int cpu)
270270
}
271271
#endif
272272

273-
#ifndef arch_scale_thermal_pressure
273+
#ifndef arch_scale_hw_pressure
274274
static __always_inline
275-
unsigned long arch_scale_thermal_pressure(int cpu)
275+
unsigned long arch_scale_hw_pressure(int cpu)
276276
{
277277
return 0;
278278
}
279279
#endif
280280

281-
#ifndef arch_update_thermal_pressure
281+
#ifndef arch_update_hw_pressure
282282
static __always_inline
283-
void arch_update_thermal_pressure(const struct cpumask *cpus,
283+
void arch_update_hw_pressure(const struct cpumask *cpus,
284284
unsigned long capped_frequency)
285285
{ }
286286
#endif

include/trace/events/thermal_pressure.h renamed to include/trace/events/hw_pressure.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
#undef TRACE_SYSTEM
3-
#define TRACE_SYSTEM thermal_pressure
3+
#define TRACE_SYSTEM hw_pressure
44

55
#if !defined(_TRACE_THERMAL_PRESSURE_H) || defined(TRACE_HEADER_MULTI_READ)
66
#define _TRACE_THERMAL_PRESSURE_H
77

88
#include <linux/tracepoint.h>
99

10-
TRACE_EVENT(thermal_pressure_update,
11-
TP_PROTO(int cpu, unsigned long thermal_pressure),
12-
TP_ARGS(cpu, thermal_pressure),
10+
TRACE_EVENT(hw_pressure_update,
11+
TP_PROTO(int cpu, unsigned long hw_pressure),
12+
TP_ARGS(cpu, hw_pressure),
1313

1414
TP_STRUCT__entry(
15-
__field(unsigned long, thermal_pressure)
15+
__field(unsigned long, hw_pressure)
1616
__field(int, cpu)
1717
),
1818

1919
TP_fast_assign(
20-
__entry->thermal_pressure = thermal_pressure;
20+
__entry->hw_pressure = hw_pressure;
2121
__entry->cpu = cpu;
2222
),
2323

24-
TP_printk("cpu=%d thermal_pressure=%lu", __entry->cpu, __entry->thermal_pressure)
24+
TP_printk("cpu=%d hw_pressure=%lu", __entry->cpu, __entry->hw_pressure)
2525
);
2626
#endif /* _TRACE_THERMAL_PRESSURE_H */
2727

include/trace/events/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ DECLARE_TRACE(pelt_dl_tp,
752752
TP_PROTO(struct rq *rq),
753753
TP_ARGS(rq));
754754

755-
DECLARE_TRACE(pelt_thermal_tp,
755+
DECLARE_TRACE(pelt_hw_tp,
756756
TP_PROTO(struct rq *rq),
757757
TP_ARGS(rq));
758758

init/Kconfig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,24 +547,24 @@ config HAVE_SCHED_AVG_IRQ
547547
depends on IRQ_TIME_ACCOUNTING || PARAVIRT_TIME_ACCOUNTING
548548
depends on SMP
549549

550-
config SCHED_THERMAL_PRESSURE
550+
config SCHED_HW_PRESSURE
551551
bool
552552
default y if ARM && ARM_CPU_TOPOLOGY
553553
default y if ARM64
554554
depends on SMP
555555
depends on CPU_FREQ_THERMAL
556556
help
557-
Select this option to enable thermal pressure accounting in the
558-
scheduler. Thermal pressure is the value conveyed to the scheduler
557+
Select this option to enable HW pressure accounting in the
558+
scheduler. HW pressure is the value conveyed to the scheduler
559559
that reflects the reduction in CPU compute capacity resulted from
560-
thermal throttling. Thermal throttling occurs when the performance of
561-
a CPU is capped due to high operating temperatures.
560+
HW throttling. HW throttling occurs when the performance of
561+
a CPU is capped due to high operating temperatures as an example.
562562

563563
If selected, the scheduler will be able to balance tasks accordingly,
564564
i.e. put less load on throttled CPUs than on non/less throttled ones.
565565

566566
This requires the architecture to implement
567-
arch_update_thermal_pressure() and arch_scale_thermal_pressure().
567+
arch_update_hw_pressure() and arch_scale_thermal_pressure().
568568

569569
config BSD_PROCESS_ACCT
570570
bool "BSD Process Accounting"

kernel/sched/core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_rt_tp);
108108
EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_dl_tp);
109109
EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_irq_tp);
110110
EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_se_tp);
111-
EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_thermal_tp);
111+
EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_hw_tp);
112112
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_cpu_capacity_tp);
113113
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_overutilized_tp);
114114
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_cfs_tp);
@@ -5668,7 +5668,7 @@ void sched_tick(void)
56685668
struct rq *rq = cpu_rq(cpu);
56695669
struct task_struct *curr = rq->curr;
56705670
struct rq_flags rf;
5671-
unsigned long thermal_pressure;
5671+
unsigned long hw_pressure;
56725672
u64 resched_latency;
56735673

56745674
if (housekeeping_cpu(cpu, HK_TYPE_TICK))
@@ -5679,8 +5679,8 @@ void sched_tick(void)
56795679
rq_lock(rq, &rf);
56805680

56815681
update_rq_clock(rq);
5682-
thermal_pressure = arch_scale_thermal_pressure(cpu_of(rq));
5683-
update_thermal_load_avg(rq_clock_thermal(rq), rq, thermal_pressure);
5682+
hw_pressure = arch_scale_hw_pressure(cpu_of(rq));
5683+
update_hw_load_avg(rq_clock_hw(rq), rq, hw_pressure);
56845684
curr->sched_class->task_tick(rq, curr, 0);
56855685
if (sched_feat(LATENCY_WARN))
56865686
resched_latency = cpu_resched_latency(rq);

0 commit comments

Comments
 (0)