Эх сурвалжийг харах

workqueue: fix worker management invocation without pending works

When there's no pending work to do, worker_thread() goes back to sleep
after waking up without checking whether worker management is
necessary.  This means that idle worker exit requests can be ignored
if the gcwq stays empty.

Fix it by making worker_thread() always check whether worker
management is necessary before going to sleep.

Signed-off-by: Tejun Heo <tj@kernel.org>
Tejun Heo 15 жил өмнө
parent
commit
d313dd85ad
1 өөрчлөгдсөн 2 нэмэгдсэн , 2 устгасан
  1. 2 2
      kernel/workqueue.c

+ 2 - 2
kernel/workqueue.c

@@ -1832,10 +1832,10 @@ recheck:
 	} while (keep_working(gcwq));
 
 	worker_set_flags(worker, WORKER_PREP, false);
-
+sleep:
 	if (unlikely(need_to_manage_workers(gcwq)) && manage_workers(worker))
 		goto recheck;
-sleep:
+
 	/*
 	 * gcwq->lock is held and there's no work to process and no
 	 * need to manage, sleep.  Workers are woken up only while