mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
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
Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: I054740a7f60301d5a3b085bfa540d52853f5eec5
(cherry picked from commit e209b3b88d)
This commit is contained in:
@@ -44,11 +44,13 @@
|
||||
#include <trace/hooks/fips140.h>
|
||||
#include <trace/hooks/dmabuf.h>
|
||||
#include <trace/hooks/timer.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_is_fpsimd_save);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_transaction_init);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_set_priority);
|
||||
|
||||
@@ -25,6 +25,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;
|
||||
@@ -149,6 +150,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;
|
||||
}
|
||||
|
||||
29
include/trace/hooks/topology.h
Normal file
29
include/trace/hooks/topology.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/* 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;
|
||||
|
||||
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
|
||||
|
||||
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));
|
||||
|
||||
#else
|
||||
|
||||
#define trace_android_vh_arch_set_freq_scale(cpus, freq, max, scale)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _TRACE_HOOK_TOPOLOGY_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
Reference in New Issue
Block a user