提交 d313dd85 编写于 作者: T Tejun Heo

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: NTejun Heo <tj@kernel.org>
上级 a1e453d2
...@@ -1832,10 +1832,10 @@ static int worker_thread(void *__worker) ...@@ -1832,10 +1832,10 @@ static int worker_thread(void *__worker)
} while (keep_working(gcwq)); } while (keep_working(gcwq));
worker_set_flags(worker, WORKER_PREP, false); worker_set_flags(worker, WORKER_PREP, false);
sleep:
if (unlikely(need_to_manage_workers(gcwq)) && manage_workers(worker)) if (unlikely(need_to_manage_workers(gcwq)) && manage_workers(worker))
goto recheck; goto recheck;
sleep:
/* /*
* gcwq->lock is held and there's no work to process and no * gcwq->lock is held and there's no work to process and no
* need to manage, sleep. Workers are woken up only while * need to manage, sleep. Workers are woken up only while
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册