Re: [PATCH 2/3] workqueue: expose per-workqueue stats in debugfs

From: Tejun Heo

Date: Fri Oct 23 2026 - 12:55:30 EST


Hello, Wilson.

On Fri, Oct 23, 2026 at 02:46:09AM +0000, Wilson Felipe Pereira wrote:
> That's fair, I thought it could be useful to have a file interface
> exposing these stats, but BPF/BTF is simple enough as well.

If you want a file-like interface, look at BPF iterators. I'm not
necessarily against adding an iter/workqueue target but it isn't really
necessary either. A userspace program can talk to the BPF side and
expose the data to the collector however it wants, e.g. a named FIFO, a
tmpfs file, whatever.

> If you still think the other two patches make sense to you, I can send a
> v2 without patch 2.

The extra stats the patches add can easily be gathered with BPF hooks.
The in-kernel stats are there because we don't want to add hooks for hot
path events. For cold path events, it's easy to add monitoring to
whatever you want. An fentry hook on pwq_release_workfn(), for example,
sees a released pwq's final counters, which is what the retired stats in
patch 1 collect.

Thanks.

--
tejun