workqueue: improve the draining/destroying warning in __queue_work
PATCH 1/1 workqueue: improve the draining/destroying warning in __queue_work
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 <[email protected]>
--- kernel/workqueue.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
kernel/workqueue.c +9 -5
@@ -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).
Signature · 1 line
2.53.0