ANDROID: vendor_hooks: Add hooks for oem percpu-rwsem optimaton

Recently we have discovered many lag issues caused by percpu_rwsem
lock-holding tasks not being scheduled for a long time. we need to
identify them and provide appropriate scheduling protection in our
oem scheduler.
To support this, we add one hook below:
	trace_android_vh_percpu_rwsem_wq_add

Bug: 301066838
Change-Id: Id770c1a7978842abfc62d3fa9aeb5ac7a1904972
Signed-off-by: xieliujie <xieliujie@oppo.com>
This commit is contained in:
xieliujie 2023-09-20 09:20:21 +08:00 committed by Treehugger Robot
parent a3cb85bffe
commit f451f4a599
3 changed files with 5 additions and 0 deletions

View File

@ -182,6 +182,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_record_mutex_lock_starttime);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_record_rtmutex_lock_starttime);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_record_rwsem_lock_starttime);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_record_pcpu_rwsem_starttime);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_percpu_rwsem_wq_add);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_module_core_rw_nx);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_module_init_rw_nx);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_module_permit_before_init);

View File

@ -84,6 +84,9 @@ DECLARE_HOOK(android_vh_record_pcpu_rwsem_starttime,
DECLARE_HOOK(android_vh_record_pcpu_rwsem_time_early,
TP_PROTO(unsigned long settime_jiffies, struct percpu_rw_semaphore *sem),
TP_ARGS(settime_jiffies, sem));
DECLARE_HOOK(android_vh_percpu_rwsem_wq_add,
TP_PROTO(struct percpu_rw_semaphore *sem, bool reader),
TP_ARGS(sem, reader));
struct mutex_waiter;
DECLARE_HOOK(android_vh_alter_mutex_list_add,

View File

@ -181,6 +181,7 @@ static void percpu_rwsem_wait(struct percpu_rw_semaphore *sem, bool reader)
if (wait) {
wq_entry.flags |= WQ_FLAG_EXCLUSIVE | reader * WQ_FLAG_CUSTOM;
__add_wait_queue_entry_tail(&sem->waiters, &wq_entry);
trace_android_vh_percpu_rwsem_wq_add(sem, reader);
}
spin_unlock_irq(&sem->waiters.lock);