ANDROID: vendor_hooks: Add hooks for rwsem and mutex

Add hooks to apply oem's optimization of rwsem and mutex

Bug: 182237112
Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: I6332623732e2d6826b8b61087ca74e55393e0c3d
(cherry picked from commit 0902cc73b793f8b8cc2a80943d85d4ca9b98278b)
This commit is contained in:
xieliujie
2021-03-09 22:15:47 +08:00
committed by Jing Xia
parent 0fb2278c2a
commit 7e4bce0e13
3 changed files with 18 additions and 1 deletions
+2
View File
@@ -148,3 +148,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_write_finished);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_rwsem_list_add);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_downgrade_wake_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_mutex_list_add);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath);
+11
View File
@@ -49,6 +49,17 @@ DECLARE_HOOK(android_vh_sched_show_task,
TP_PROTO(struct task_struct *task),
TP_ARGS(task));
struct mutex_waiter;
DECLARE_HOOK(android_vh_alter_mutex_list_add,
TP_PROTO(struct mutex *lock,
struct mutex_waiter *waiter,
struct list_head *list,
bool *already_on_list),
TP_ARGS(lock, waiter, list, already_on_list));
DECLARE_HOOK(android_vh_mutex_unlock_slowpath,
TP_PROTO(struct mutex *lock),
TP_ARGS(lock));
#endif /* _TRACE_HOOK_DTASK_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
+5 -1
View File
@@ -183,9 +183,12 @@ static void
__mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
struct list_head *list)
{
bool already_on_list = false;
debug_mutex_add_waiter(lock, waiter, current);
list_add_tail(&waiter->list, list);
trace_android_vh_alter_mutex_list_add(lock, waiter, list, &already_on_list);
if (!already_on_list)
list_add_tail(&waiter->list, list);
if (__mutex_waiter_is_first(lock, waiter))
__mutex_set_flag(lock, MUTEX_FLAG_WAITERS);
}
@@ -945,6 +948,7 @@ static noinline void __sched __mutex_unlock_slowpath(struct mutex *lock, unsigne
raw_spin_unlock_irqrestore(&lock->wait_lock, flags);
wake_up_q(&wake_q);
preempt_enable();
trace_android_vh_mutex_unlock_slowpath(lock);
}
#ifndef CONFIG_DEBUG_LOCK_ALLOC