Re: [PATCH RFC] workqueue: Make show_pwq() use run-length encoding
From: Tejun Heo
Date: Fri Jan 06 2023 - 19:25:02 EST
On Fri, Jan 06, 2023 at 04:10:24PM -0800, Paul E. McKenney wrote:
> The show_pwq() function dumps out a pool_workqueue structure's activity,
> including the pending work-queue handlers:
>
> Showing busy workqueues and worker pools:
> workqueue events: flags=0x0
> pwq 0: cpus=0 node=0 flags=0x1 nice=0 active=10/256 refcnt=11
> in-flight: 7:test_work_func, 64:test_work_func, 249:test_work_func
> pending: test_work_func, test_work_func, test_work_func1, test_work_func1, test_work_func1, test_work_func1, test_work_func1
>
> When large systems are facing certain types of hang conditions, it is not
> unusual for this "pending" list to contain runs of hundreds of identical
> function names. This "wall of text" is difficult to read, and worse yet,
> it can be interleaved with other output such as stack traces.
>
> Therefore, make show_pwq() use run-length encoding so that the above
> printout instead looks like this:
>
> Showing busy workqueues and worker pools:
> workqueue events: flags=0x0
> pwq 0: cpus=0 node=0 flags=0x1 nice=0 active=10/256 refcnt=11
> in-flight: 7:test_work_func, 64:test_work_func, 249:test_work_func
> pending: 2*test_work_func, 5*test_work_func1
>
> When no comma would be printed, including the WORK_STRUCT_LINKED case,
> a new run is started unconditionally.
>
> This output is more readable, places less stress on the hardware,
> firmware, and software on the console-log path, and reduces interference
> with other output.
This is fantastic. Applied to wq/for-6.3.
Thanks.
--
tejun