ANDROID: futex: Add vendor hook for wait queue
Add the hook for the waiter list of futex to allow vendor perform wait queue enhancement Bug: 381487678 Signed-off-by: JianMin Liu <jian-min.liu@mediatek.com> Signed-off-by: Guan-Wun Chen <guan-wun.chen@mediatek.corp-partner.google.com> Change-Id: I68218b89c35b23aa5529099bb0bbbd031bdeafef
This commit is contained in:
committed by
Treehugger Robot
parent
067ce58e1a
commit
58f9c9a064
@@ -46,6 +46,7 @@
|
||||
#include <trace/hooks/topology.h>
|
||||
#include <trace/hooks/rwsem.h>
|
||||
#include <trace/hooks/bl_hib.h>
|
||||
#include <trace/hooks/futex.h>
|
||||
|
||||
/*
|
||||
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
||||
@@ -164,3 +165,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_hibernation_swap);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_cpu_resume);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_hib_resume_bdev);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_futex_plist_add);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM futex
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#define TRACE_INCLUDE_PATH trace/hooks
|
||||
#if !defined(_TRACE_HOOK_FUTEX_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HOOK_FUTEX_H
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
/*
|
||||
* Following tracepoints are not exported in tracefs and provide a
|
||||
* mechanism for vendor modules to hook and extend functionality
|
||||
*/
|
||||
struct plist_node;
|
||||
struct plist_head;
|
||||
DECLARE_HOOK(android_vh_alter_futex_plist_add,
|
||||
TP_PROTO(struct plist_node *node,
|
||||
struct plist_head *head,
|
||||
bool *already_on_hb),
|
||||
TP_ARGS(node, head, already_on_hb));
|
||||
#endif /* _TRACE_HOOK_FUTEX_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
+5
-1
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "futex.h"
|
||||
#include "../locking/rtmutex_common.h"
|
||||
#include <trace/hooks/futex.h>
|
||||
|
||||
/*
|
||||
* The base of the bucket array and its size are always used together
|
||||
@@ -557,6 +558,7 @@ void futex_q_unlock(struct futex_hash_bucket *hb)
|
||||
void __futex_queue(struct futex_q *q, struct futex_hash_bucket *hb)
|
||||
{
|
||||
int prio;
|
||||
bool already_on_hb = false;
|
||||
|
||||
/*
|
||||
* The priority used to register this element is
|
||||
@@ -569,7 +571,9 @@ void __futex_queue(struct futex_q *q, struct futex_hash_bucket *hb)
|
||||
prio = min(current->normal_prio, MAX_RT_PRIO);
|
||||
|
||||
plist_node_init(&q->list, prio);
|
||||
plist_add(&q->list, &hb->chain);
|
||||
trace_android_vh_alter_futex_plist_add(&q->list, &hb->chain, &already_on_hb);
|
||||
if (!already_on_hb)
|
||||
plist_add(&q->list, &hb->chain);
|
||||
q->task = current;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user