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 <xieliujie@oppo.com>
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
This commit is contained in:
Liujie Xie 2021-03-16 20:48:42 +08:00 committed by Shaleen Agrawal
parent cf22aa5ebd
commit 5ec033b0cc
3 changed files with 16 additions and 4 deletions

View File

@ -526,7 +526,7 @@ static void binder_wakeup_poll_threads_ilocked(struct binder_proc *proc,
thread = rb_entry(n, struct binder_thread, rb_node);
if (thread->looper & BINDER_LOOPER_STATE_POLL &&
binder_available_for_proc_work_ilocked(thread)) {
trace_android_vh_binder_wakeup_ilocked(thread->task);
trace_android_vh_binder_wakeup_ilocked(thread->task, sync, proc);
if (sync)
wake_up_interruptible_sync(&thread->wait);
else
@ -586,7 +586,7 @@ static void binder_wakeup_thread_ilocked(struct binder_proc *proc,
assert_spin_locked(&proc->inner_lock);
if (thread) {
trace_android_vh_binder_wakeup_ilocked(thread->task);
trace_android_vh_binder_wakeup_ilocked(thread->task, sync, proc);
if (sync)
wake_up_interruptible_sync(&thread->wait);
else
@ -3875,6 +3875,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);
@ -4245,6 +4246,7 @@ static int binder_thread_read(struct binder_proc *proc,
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;
}

View File

@ -153,6 +153,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cgroup_force_kthread_migration);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_check_preempt_tick);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_check_preempt_wakeup_ignore);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_replace_next_task_fair);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_wait_for_work);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sync_txn_recvd);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_build_sched_domains);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_update_topology_flags_workfn);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_balance_rt);

View File

@ -22,9 +22,17 @@ 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));
struct binder_proc;
struct binder_thread;
DECLARE_HOOK(android_vh_binder_wakeup_ilocked,
TP_PROTO(struct task_struct *task),
TP_ARGS(task));
TP_PROTO(struct task_struct *task, bool sync, struct binder_proc *proc),
TP_ARGS(task, sync, proc));
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 <trace/define_trace.h>