ANDROID: vendor_hooks: add hook in __alloc_workqueue()

This hook is used to apply specific flags/max_active to workqueue.
It can solve some priority inversion cases.

Bug: 417083554
Change-Id: I7f8faf6652a5e3f12c44e97df0d665a39d2e9540
Signed-off-by: jiayingrui <jiayingrui@oppo.com>
This commit is contained in:
jiayingrui
2025-05-12 12:49:50 +08:00
committed by Treehugger Robot
parent c7b71fcb6f
commit b62718ba86
3 changed files with 6 additions and 0 deletions

View File

@@ -105,6 +105,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpu_idle_exit);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mpam_set);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_wq_lockup_pool);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_alloc_and_link_pwqs);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_alloc_workqueue);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_create_worker);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ipi_stop);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sysrq_crash);

View File

@@ -10,6 +10,10 @@
* Following tracepoints are not exported in tracefs and provide a
* mechanism for vendor modules to hook and extend functionality
*/
DECLARE_RESTRICTED_HOOK(android_rvh_alloc_workqueue,
TP_PROTO(struct workqueue_struct *wq, unsigned int *flags, int *max_active),
TP_ARGS(wq, flags, max_active), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_create_worker,
TP_PROTO(struct task_struct *p, struct workqueue_attrs *attrs),
TP_ARGS(p, attrs), 1);

View File

@@ -5707,6 +5707,7 @@ static struct workqueue_struct *__alloc_workqueue(const char *fmt,
max_active = wq_clamp_max_active(max_active, flags, wq->name);
}
trace_android_rvh_alloc_workqueue(wq, &flags, &max_active);
/* init wq */
wq->flags = flags;
wq->max_active = max_active;