ANDROID: sched: core: hook for get_nohz_timer_target

Allow module to control behavior of get_nohz_timer_target.

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

View File

@@ -196,6 +196,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_bpf_syscall);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_ptr_locked);
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);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_em_dev_register_pd);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_logbuf);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_logbuf_pr_cont);

View File

@@ -65,6 +65,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_is_cpu_allowed,
TP_PROTO(int cpu, bool *allowed),
TP_ARGS(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

@@ -1024,6 +1024,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_FLAG_TIMER)) {
if (!idle_cpu(cpu))