From 937bd07184e5fe5110f50803ce6a057da9b00342 Mon Sep 17 00:00:00 2001 From: Liujie Xie Date: Tue, 16 Mar 2021 20:48:42 +0800 Subject: [PATCH] ANDROID: vendor_hooks: Add hooks for improving binder trans Recognize important binder proc & binder thread and improve their sched lantency. Bug: 182952552 Change-Id: I174949bf90a4215a6d27f24abbc7d324a321e662 Signed-off-by: Liujie Xie Signed-off-by: Shaleen Agrawal --- drivers/android/binder.c | 2 ++ drivers/android/vendor_hooks.c | 2 ++ include/trace/hooks/binder.h | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 688fa9ca8f1b..de439ef0061b 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -4778,6 +4778,7 @@ static int binder_wait_for_work(struct binder_thread *thread, if (do_proc_work) list_add(&thread->waiting_thread_node, &proc->waiting_threads); + trace_android_vh_binder_wait_for_work(do_proc_work, thread, proc); binder_inner_proc_unlock(proc); schedule(); binder_inner_proc_lock(proc); @@ -5175,6 +5176,7 @@ retry: trd->sender_pid = task_tgid_nr_ns(sender, task_active_pid_ns(current)); + trace_android_vh_sync_txn_recvd(thread->task, t_from->task); } else { trd->sender_pid = 0; } diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 7176b9845d2d..72e16f34b8d6 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -91,6 +91,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_allow_domain_state); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_enter); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_exit); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpufreq_transition); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sync_txn_recvd); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_balance_anon_file_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_show_max_freq); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_avc_insert); @@ -120,6 +121,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_alloc); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_isolate_freepages); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_oom_check_panic); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_wait_for_work); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_folio_look_around_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_folio); diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index fbac6dcadb5b..459413d397a3 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -12,6 +12,8 @@ */ struct binder_transaction; struct task_struct; +struct binder_thread; +struct binder_proc; DECLARE_HOOK(android_vh_binder_transaction_init, TP_PROTO(struct binder_transaction *t), TP_ARGS(t)); @@ -21,6 +23,12 @@ DECLARE_HOOK(android_vh_binder_set_priority, DECLARE_HOOK(android_vh_binder_restore_priority, TP_PROTO(struct binder_transaction *t, struct task_struct *task), TP_ARGS(t, task)); +DECLARE_HOOK(android_vh_binder_wait_for_work, + TP_PROTO(bool do_proc_work, struct binder_thread *tsk, struct binder_proc *proc), + TP_ARGS(do_proc_work, tsk, proc)); +DECLARE_HOOK(android_vh_sync_txn_recvd, + TP_PROTO(struct task_struct *tsk, struct task_struct *from), + TP_ARGS(tsk, from)); #endif /* _TRACE_HOOK_BINDER_H */ /* This part must be outside protection */ #include