ANDROID: sched: core: hook for get_nohz_timer_target

Allow module to control behavior of get_nohz_timer_target.
This is needed to implement CPU Pause via vendor modules.

Bug: 205164003
Change-Id: I38cb201ebf06db7bbce0d6cb68dbbe3729355be8
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
This commit is contained in:
Stephen Dickey 2022-01-06 16:11:49 -08:00 committed by Todd Kjos
parent e8c5163f9b
commit 6fb5714d19
3 changed files with 10 additions and 0 deletions

View File

@ -64,6 +64,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_is_cpu_allowed,
TP_PROTO(struct task_struct *p, int cpu, bool *allowed),
TP_ARGS(p, cpu, allowed), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_get_nohz_timer_target,
TP_PROTO(int *cpu, bool *done),
TP_ARGS(cpu, done), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_set_user_nice,
TP_PROTO(struct task_struct *p, long *nice, bool *allowed),
TP_ARGS(p, nice, allowed), 1);

View File

@ -1088,6 +1088,11 @@ int get_nohz_timer_target(void)
int i, cpu = smp_processor_id(), default_cpu = -1;
struct sched_domain *sd;
const struct cpumask *hk_mask;
bool done = false;
trace_android_rvh_get_nohz_timer_target(&cpu, &done);
if (done)
return cpu;
if (housekeeping_cpu(cpu, HK_TYPE_TIMER)) {
if (!idle_cpu(cpu))

View File

@ -73,3 +73,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_cpu_capacity);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_misfit_status);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_rto_next_cpu);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_is_cpu_allowed);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_get_nohz_timer_target);