workqueue: Introduce __show_worker_pool_state and __show_workqueue_state.
RFC PATCH v2 1/1 workqueue: Introduce __show_worker_pool_state and __show_workqueue_state.
Currently show_workqueue_state shows the state of all workqueues and of all worker pools. In certain cases we may need to dump state of only a specific workqueue or worker pool. For example in destroy_workqueue we only need to show state of the workqueue which is getting destroyed.
So divide show_workqueue_state into more granular functions (__show_workqueue_state and __show_worker_pool_state), that would show states of individual workqueues and worker pools and can be used in cases such as the one mentioned above.
Also, as mentioned earlier, make destroy_workqueue dump data pertaining to only the workqueue that is being destroyed.
---
Changes in v2:
- Update patch description
- Dump state of only relevant workqueue in destroy_workqueue
include/linux/workqueue.h | 1 + kernel/workqueue.c | 142 ++++++++++++++++++++++---------------- 2 files changed, 82 insertions(+), 61 deletions(-)
include/linux/workqueue.h +1 -0
@@ -471,6 +471,7 @@ extern unsigned int work_busy(struct work_struct *work); extern __printf(1, 2) void set_worker_desc(const char *fmt, ...); extern void print_worker_info(const char *log_lvl, struct task_struct *task); extern void show_workqueue_state(void); +extern void __show_workqueue_state(struct workqueue_struct *wq); extern void wq_worker_comm(char *buf, size_t size, struct task_struct *task); /**
kernel/workqueue.c +81 -61
173 lines not on this page · raw message
base-commit: 29616f67fcbd6b26242440372a3b0f0a085109c6
Signature · 1 line
2.30.2
Tejun Heo
maintainerQuoted 2 lines · Imran Khan
So divide
show_workqueue_stateinto more granular functions (__show_workqueue_stateand__show_worker_pool_state), that would show
This is nit-picky but can we please name them sth like show_one_workqueue_state() and show_one_worker_pool_state() or just show_one_workqueue() and show_one_worker_pool() with the corresponding versions renamed to show_all_workqueues() and show_all_worker_pools()?
Thanks.
Signature · 1 line
tejun
Hi Tejun,
Sorry for getting back late on this.
Quoted 9 lines · Tejun Heo
Quoted 2 lines · Imran Khan
So divide
show_workqueue_stateinto more granular functions (__show_workqueue_stateand__show_worker_pool_state), that would showThis is nit-picky but can we please name them sth like
show_one_workqueue_state()andshow_one_worker_pool_state()or justshow_one_workqueue()andshow_one_worker_pool()with the corresponding versions renamed toshow_all_workqueues()andshow_all_worker_pools()?
Yes. This sounds good to me. I have renamed the functions as show_one_workqueue() and show_one_worker_pool(). On the same lines I have renamed show_workqueue_state() to show_all_workqueues(). These changes are available in v3 of the patch [1].
[1] https://lore.kernel.org/lkml/[email protected]/
Thanks again for reviewing this.
-- Imran
Quoted 2 lines
Thanks.