From 25d43121e3f3902876198cd4deb803ce76b944d3 Mon Sep 17 00:00:00 2001 From: Yang Yang Date: Wed, 14 Aug 2024 18:37:22 +0800 Subject: [PATCH] ANDROID: vendor_hooks: add hook in create_worker() This hook is used to apply specific scheduling policies to worker->task Bug: 360039558 Bug: 408116496 Change-Id: I4fb79b23bced1c58a6fa5f4d0c19850f11d56e0f Signed-off-by: Yang Yang (cherry picked from commit 2041959e88de73c2487def20a89c60a7f8177938) Signed-off-by: ying zuxin <11154159@vivo.com> --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/wqlockup.h | 4 ++++ kernel/workqueue.c | 1 + 3 files changed, 6 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 053da9f9ec74..905e9d7e3305 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -102,6 +102,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_create_worker); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ipi_stop); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sysrq_crash); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_printk_hotplug); diff --git a/include/trace/hooks/wqlockup.h b/include/trace/hooks/wqlockup.h index 84286d1b3352..b17c3a08e615 100644 --- a/include/trace/hooks/wqlockup.h +++ b/include/trace/hooks/wqlockup.h @@ -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_create_worker, + TP_PROTO(struct task_struct *p, struct workqueue_attrs *attrs), + TP_ARGS(p, attrs), 1); + DECLARE_HOOK(android_vh_wq_lockup_pool, TP_PROTO(int cpu, unsigned long pool_ts), TP_ARGS(cpu, pool_ts)); diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c18f3398e75f..6a2f60a2fcd6 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -2812,6 +2812,7 @@ static struct worker *create_worker(struct worker_pool *pool) } set_user_nice(worker->task, pool->attrs->nice); + trace_android_rvh_create_worker(worker->task, pool->attrs); kthread_bind_mask(worker->task, pool_allowed_cpus(pool)); }