Skip to contentSkip to conversation

workqueue: Introduce show_one_worker_pool and show_one_workqueue.

RFC PATCH Applied Imran Khan 3 participants 4 messages Oct 20, 2021

Subsystems (4)
lore
Share & tools
lore

Imran Khan

author
#0 lore raw

RFC PATCH v4 1/1 workqueue: Introduce show_one_worker_pool and show_one_workqueue.

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 rename show_workqueue_state to show_all_workqueues(to signify it dumps state of all busy workqueues) and divide it into more granular functions (show_one_workqueue and show_one_worker_pool), 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 and make user(s) of earlier interface(show_workqueue_state), use new interface (show_all_workqueues).

---
Changes in v4:
- Rebase on git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git

    for-5.16
 drivers/tty/sysrq.c       |   2 +-
 include/linux/workqueue.h |   3 +-
 kernel/power/process.c    |   2 +-
 kernel/workqueue.c        | 172 +++++++++++++++++++++-----------------
 4 files changed, 100 insertions(+), 79 deletions(-)
drivers/tty/sysrq.c +1 -1
index c911196ac893..8d0f07509ca7 100644
@@ -296,7 +296,7 @@ static const struct sysrq_key_op sysrq_showregs_op = {
 static void sysrq_handle_showstate(int key)
 {
 	show_state();
-	show_workqueue_state();
+	show_all_workqueues();
 }
 static const struct sysrq_key_op sysrq_showstate_op = {
 	.handler	= sysrq_handle_showstate,
include/linux/workqueue.h +2 -1
index 74d3c1efd9bb..7fee9b6cfede 100644
@@ -469,7 +469,8 @@ extern bool workqueue_congested(int cpu, struct workqueue_struct *wq);
 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_all_workqueues(void);
+extern void show_one_workqueue(struct workqueue_struct *wq);
 extern void wq_worker_comm(char *buf, size_t size, struct task_struct *task);
 
 /**
kernel/power/process.c +1 -1
index 37401c99b7d7..b7e7798637b8 100644
@@ -94,7 +94,7 @@ static int try_to_freeze_tasks(bool user_only)
 		       todo - wq_busy, wq_busy);
 
 		if (wq_busy)
-			show_workqueue_state();
+			show_all_workqueues();
 
 		if (!wakeup || pm_debug_messages_on) {
 			read_lock(&tasklist_lock);
kernel/workqueue.c +96 -76

213 lines not on this page · raw message

base-commit: d25302e46592c97d29f70ccb1be558df31a9a360

Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 16 lines · Imran Khan

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 rename show_workqueue_state to show_all_workqueues(to signify it dumps state of all busy workqueues) and divide it into more granular functions (show_one_workqueue and show_one_worker_pool), 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 and make user(s) of earlier interface(show_workqueue_state), use new interface (show_all_workqueues).

Quoted 5 lines

---
Changes in v4:
- Rebase on git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git

    for-5.16

"RFC" means "I am not sure about this patch, please do not apply it."

Yet a v4 is very odd, why not be sure about this?

thanks,

greg k-h

author
#2 lore raw

Hi Greg,

Quoted 1 line · Greg KH

On Wed, Oct 20, 2021 at 02:09:00PM +1100, Imran Khan wrote:

[...]

Quoted 9 lines
Quoted 6 lines

---
Changes in v4:
- Rebase on git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git

     for-5.16

"RFC" means "I am not sure about this patch, please do not apply it."

Thanks for clarifying this.

Quoted 1 line

Yet a v4 is very odd, why not be sure about this?

I have not got any negative feedback about the change so far, so I am fairly sure about it now. There was a mistake in my understanding where I thought that something that starts as an RFC remains like that in subsequent revisions. I will definitely be mindful about it in future. Could you please let me know if I should send a "PATCH v5", removing RFC from the subject.

Thanks,
Imran

Quoted 5 lines

thanks,

greg k-h

maintainer Applied
#3 lore raw
In reply to Imran Khan
Quoted 11 lines · Imran Khan

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 rename show_workqueue_state to show_all_workqueues(to signify it dumps state of all busy workqueues) and divide it into more granular functions (show_one_workqueue and show_one_worker_pool), that would show states of individual workqueues and worker pools and can be used in cases such as the one mentioned above.

Quoted 6 lines

Also, as mentioned earlier, make destroy_workqueue dump data pertaining to only the workqueue that is being destroyed and make user(s) of earlier interface(show_workqueue_state), use new interface (show_all_workqueues).

Applied to wq/for-5.16.

Thank you.

Signature · 1 line
tejun