workqueue: Fix hung time report of worker pools
ANBZ: #9497 commit335a42ebb0
upstream. The workqueue watchdog prints a warning when there is no progress in a worker pool. Where the progress means that the pool started processing a pending work item. Note that it is perfectly fine to process work items much longer. The progress should be guaranteed by waking up or creating idle workers. show_one_worker_pool() prints state of non-idle worker pool. It shows a delay since the last pool->watchdog_ts. The timestamp is updated when a first pending work is queued in __queue_work(). Also it is updated when a work is dequeued for processing in worker_thread() and rescuer_thread(). The delay is misleading when there is no pending work item. In this case it shows how long the last work item is being proceed. Show zero instead. There is no stall if there is no pending work. Fixes:82607adcf9
("workqueue: implement lockup detector") Signed-off-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit 647781347af925268434c5dc99b04f7077de8e8e) Signed-off-by: Tianchen Ding <dtcccc@linux.alibaba.com> Reviewed-by: Cruz Zhao <CruzZhao@linux.alibaba.com> Link: https://gitee.com/anolis/cloud-kernel/pulls/3549
This commit is contained in:
parent
b3c69b8851
commit
3489161738
|
@ -4816,16 +4816,19 @@ void show_workqueue_state(void)
|
|||
for_each_pool(pool, pi) {
|
||||
struct worker *worker;
|
||||
bool first = true;
|
||||
unsigned long hung = 0;
|
||||
|
||||
raw_spin_lock_irqsave(&pool->lock, flags);
|
||||
if (pool->nr_workers == pool->nr_idle)
|
||||
goto next_pool;
|
||||
|
||||
/* How long the first pending work is waiting for a worker. */
|
||||
if (!list_empty(&pool->worklist))
|
||||
hung = jiffies_to_msecs(jiffies - pool->watchdog_ts) / 1000;
|
||||
|
||||
pr_info("pool %d:", pool->id);
|
||||
pr_cont_pool_info(pool);
|
||||
pr_cont(" hung=%us workers=%d",
|
||||
jiffies_to_msecs(jiffies - pool->watchdog_ts) / 1000,
|
||||
pool->nr_workers);
|
||||
pr_cont(" hung=%lus workers=%d", hung, pool->nr_workers);
|
||||
if (pool->manager)
|
||||
pr_cont(" manager: %d",
|
||||
task_pid_nr(pool->manager->task));
|
||||
|
|
Loading…
Reference in New Issue