Skip to content
Snippets Groups Projects
Commit 90540fbb authored by xieliujie's avatar xieliujie
Browse files

ANDROID: vendor_hooks: Add hooks for rt_mutex steal


Add hooks at rt_mutex_steal function so that oems can decide
whether tasks with the same priority steal the rt_mutex or
not. We did experiments and found that rt_mutex throughput
can benefit a lot when threads with the same priority can
steal the rt_mutex lock.

Bug: 317670024
Change-Id: Id60a7a41c6c77a67808982d3667946cabe4acc8f
Signed-off-by: default avatarxeiliujie <xieliujie@oppo.com>
parent 5b36ccdd
No related merge requests found
......@@ -145,6 +145,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_task_blocks_on_rtmutex);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rtmutex_waiter_prio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rtmutex_wait_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rtmutex_wait_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rt_mutex_steal);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_opt_spin_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_opt_spin_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_can_spin_on_owner);
......
......@@ -48,6 +48,9 @@ DECLARE_HOOK(android_vh_rtmutex_wait_start,
DECLARE_HOOK(android_vh_rtmutex_wait_finish,
TP_PROTO(struct rt_mutex_base *lock),
TP_ARGS(lock));
DECLARE_HOOK(android_vh_rt_mutex_steal,
TP_PROTO(int waiter_prio, int top_waiter_prio, bool *ret),
TP_ARGS(waiter_prio, top_waiter_prio, ret));
DECLARE_HOOK(android_vh_rwsem_read_wait_start,
TP_PROTO(struct rw_semaphore *sem),
......
......@@ -389,9 +389,15 @@ static __always_inline int rt_mutex_waiter_equal(struct rt_mutex_waiter *left,
static inline bool rt_mutex_steal(struct rt_mutex_waiter *waiter,
struct rt_mutex_waiter *top_waiter)
{
bool ret = false;
if (rt_mutex_waiter_less(waiter, top_waiter))
return true;
trace_android_vh_rt_mutex_steal(waiter->prio, top_waiter->prio, &ret);
if (ret)
return true;
#ifdef RT_MUTEX_BUILD_SPINLOCKS
/*
* Note that RT tasks are excluded from same priority (lateral)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment