ANDROID: vendor_hooks: add hook in alloc_and_link_pwqs()

This hook is used to apply specific flags and attrs to workqueue_struct.

Bug: 348321531
Change-Id: I877eae65a8d02719e216ab2df6e627e360e11078
Signed-off-by: Yang Yang <yang.yang@vivo.com>
This commit is contained in:
Yang Yang 2024-06-20 17:35:32 +08:00 committed by Treehugger Robot
parent 55b691a3a1
commit f437bda7c4
3 changed files with 11 additions and 0 deletions

View File

@ -124,6 +124,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpu_idle_enter);
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_vh_ipi_stop);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sysrq_crash);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_printk_hotplug);

View File

@ -14,6 +14,10 @@ DECLARE_HOOK(android_vh_wq_lockup_pool,
TP_PROTO(int cpu, unsigned long pool_ts),
TP_ARGS(cpu, pool_ts));
DECLARE_HOOK(android_rvh_alloc_and_link_pwqs,
TP_PROTO(struct workqueue_struct *wq, int *ret, bool *skip),
TP_ARGS(wq, ret, skip));
#endif /* _TRACE_HOOK_WQLOCKUP_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@ -4578,6 +4578,7 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq)
{
bool highpri = wq->flags & WQ_HIGHPRI;
int cpu, ret;
bool skip = false;
wq->cpu_pwq = alloc_percpu(struct pool_workqueue *);
if (!wq->cpu_pwq)
@ -4604,6 +4605,10 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq)
return 0;
}
trace_android_rvh_alloc_and_link_pwqs(wq, &ret, &skip);
if (skip)
goto oem_skip;
cpus_read_lock();
if (wq->flags & __WQ_ORDERED) {
ret = apply_workqueue_attrs(wq, ordered_wq_attrs[highpri]);
@ -4616,6 +4621,7 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq)
}
cpus_read_unlock();
oem_skip:
/* for unbound pwq, flush the pwq_release_worker ensures that the
* pwq_release_workfn() completes before calling kfree(wq).
*/