Re: [PATCH] task_work: add tracepoints for task_work callbacks

From: Peter Zijlstra

Date: Wed Jun 10 2026 - 04:06:31 EST


On Wed, Jun 10, 2026 at 12:14:08PM +0800, Imran Khan wrote:
> task_work tracepoints can be enabled by:
>
> echo 1 > /sys/kernel/tracing/events/task_work/enable
>
> and trace logs would look like:
>
> ... task_work_add_request: target_comm=ls target_pid=227 work=ffff95d20641a508 func=____fput notify=TWA_RESUME
> ... task_work_add_done: target_comm=ls target_pid=227 work=ffff95d20641a508 ret=0
> ... task_work_add_request: target_comm=ls target_pid=227 work=ffff95d20641a5c8 func=____fput notify=TWA_RESUME
> ... task_work_add_done: target_comm=ls target_pid=227 work=ffff95d20641a5c8 ret=0
> ... task_work_add_request: target_comm=ls target_pid=227 work=ffff95d20641a688 func=____fput notify=TWA_RESUME
> ... task_work_add_done: target_comm=ls target_pid=227 work=ffff95d20641a688 ret=0
> ... task_work_add_request: target_comm=ls target_pid=227 work=ffff95d20641a748 func=____fput notify=TWA_RESUME
> ... task_work_add_done: target_comm=ls target_pid=227 work=ffff95d20641a748 ret=0
> ... task_work_run_start: comm=ls pid=227 work=ffff95d20641a748 func=____fput
> ... task_work_run_end: comm=ls pid=227 work=ffff95d20641a748 func=____fput
> ... task_work_run_start: comm=ls pid=227 work=ffff95d20641a688 func=____fput
> ... task_work_run_end: comm=ls pid=227 work=ffff95d20641a688 func=____fput
> ... task_work_run_start: comm=ls pid=227 work=ffff95d20641a5c8 func=____fput
> ... task_work_run_end: comm=ls pid=227 work=ffff95d20641a5c8 func=____fput
> ... task_work_run_start: comm=ls pid=227 work=ffff95d20641a508 func=____fput
> ... task_work_run_end: comm=ls pid=227 work=ffff95d20641a508 func=____fput
>
> formatted as:
> target_comm=<comm of target task>
> target_pid=<pid of target task>
> work=<callback_head *>
> func=<callback_head->func>
> notify=<way to notify the target task>
> comm=<comm of current task executing func>
> pid=<pid of current task executing func>

And not a single justification for all this nonsense :-( So much ugly
and no gain...