* [PATCH] workqueue: improve the draining/destroying warning in __queue_work
@ 2026-11-03 14:33 Christoph Hellwig
0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2026-11-03 14:33 UTC (permalink / raw)
To: tj; +Cc: jiangshanlai, linux-kernel
Tell which of the two conditions hit. And to avoid makign the code even
harder to read, move the WARN_ONCE out of the condition triggering it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
kernel/workqueue.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index f2e8071a6f4e..bea294b00d1f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2428,15 +2428,19 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
lockdep_assert_irqs_disabled();
/*
- * For a draining wq, only works from the same workqueue are
- * allowed. The __WQ_DESTROYING helps to spot the issue that
- * queues a new work item to a wq after destroy_workqueue(wq).
+ * For a draining wq, only works from the same workqueue are allowed.
+ * The __WQ_DESTROYING helps to spot the issue that queues a new work
+ * item to a wq after destroy_workqueue(wq).
*/
if (unlikely(wq->flags & (__WQ_DESTROYING | __WQ_DRAINING) &&
- WARN_ONCE(!is_chained_work(wq), "workqueue: cannot queue %ps on wq %s\n",
- work->func, wq->name))) {
+ !is_chained_work(wq))) {
struct work_offq_data offqd;
+ WARN_ONCE(1, "workqueue: cannot queue %ps on %s wq %s\n",
+ work->func, (wq->flags & __WQ_DESTROYING) ?
+ "destroying" : "draining",
+ wq->name);
+
/*
* State on entry: PENDING is set, work is off-queue (no
* insert_work() has run).
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-03 14:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 14:33 [PATCH] workqueue: improve the draining/destroying warning in __queue_work Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®