ANDROID: sched: add vendor hook for correcting cpu capacity
Current CPU capacity is scaled by frequency but it will sometime overestimate. Add vendor hook to adjust cpu capacity. android_vh_arch_set_freq_scale Adjust cpu freq scale for each opp. Bug: 163935827 Bug: 265389443 Bug: 314454881 Change-Id: I054740a7f60301d5a3b085bfa540d52853f5eec5 Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com> Signed-off-by: Han Lin <han.lin@mediatek.com> Signed-off-by: Wade Wu <wei-ya.wu@mediatek.corp-partner.google.com>
This commit is contained in:
committed by
Treehugger Robot
parent
2cfadc71a6
commit
370960fe61
@@ -40,11 +40,13 @@
|
||||
#include <trace/hooks/mm.h>
|
||||
#include <trace/hooks/traps.h>
|
||||
#include <trace/hooks/fault.h>
|
||||
#include <trace/hooks/topology.h>
|
||||
|
||||
/*
|
||||
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
||||
* associated with them) to allow external modules to probe them.
|
||||
*/
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_arch_set_freq_scale);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpu_idle_enter);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpu_idle_exit);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mpam_set);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#undef CREATE_TRACE_POINTS
|
||||
#include <trace/hooks/sched.h>
|
||||
#include <trace/hooks/topology.h>
|
||||
|
||||
static DEFINE_PER_CPU(struct scale_freq_data __rcu *, sft_data);
|
||||
static struct cpumask scale_freq_counters_mask;
|
||||
@@ -152,6 +153,8 @@ void topology_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq,
|
||||
|
||||
scale = (cur_freq << SCHED_CAPACITY_SHIFT) / max_freq;
|
||||
|
||||
trace_android_vh_arch_set_freq_scale(cpus, cur_freq, max_freq, &scale);
|
||||
|
||||
for_each_cpu(i, cpus)
|
||||
per_cpu(arch_freq_scale, i) = scale;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM topology
|
||||
|
||||
#define TRACE_INCLUDE_PATH trace/hooks
|
||||
|
||||
#if !defined(_TRACE_HOOK_TOPOLOGY_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HOOK_TOPOLOGY_H
|
||||
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
|
||||
struct cpumask;
|
||||
|
||||
DECLARE_HOOK(android_vh_arch_set_freq_scale,
|
||||
TP_PROTO(const struct cpumask *cpus, unsigned long freq, unsigned long max,
|
||||
unsigned long *scale),
|
||||
TP_ARGS(cpus, freq, max, scale));
|
||||
|
||||
#endif /* _TRACE_HOOK_TOPOLOGY_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
Reference in New Issue
Block a user