Commit b4ac9384 authored by Lai Jiangshan's avatar Lai Jiangshan Committed by Tejun Heo

workqueue: Remove schedule() in unbind_workers()

The commit 6d25be57 ("sched/core, workqueues: Distangle worker
accounting from rq lock") changed the schedule callbacks for workqueue
and moved the schedule callback from the wakeup code to at end of
schedule() in the worker's process context.

It means that the callback wq_worker_running() is guaranteed that
it sees the %WORKER_UNBOUND flag after scheduled since unbind_workers()
is running on the same CPU that all the pool's workers bound to.
Signed-off-by: default avatarLai Jiangshan <laijs@linux.alibaba.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 11b45b0b
...@@ -4979,6 +4979,9 @@ static void unbind_workers(int cpu) ...@@ -4979,6 +4979,9 @@ static void unbind_workers(int cpu)
* We've blocked all attach/detach operations. Make all workers * We've blocked all attach/detach operations. Make all workers
* unbound and set DISASSOCIATED. Before this, all workers * unbound and set DISASSOCIATED. Before this, all workers
* must be on the cpu. After this, they may become diasporas. * must be on the cpu. After this, they may become diasporas.
* And the preemption disabled section in their sched callbacks
* are guaranteed to see WORKER_UNBOUND since the code here
* is on the same cpu.
*/ */
for_each_pool_worker(worker, pool) for_each_pool_worker(worker, pool)
worker->flags |= WORKER_UNBOUND; worker->flags |= WORKER_UNBOUND;
...@@ -4994,14 +4997,6 @@ static void unbind_workers(int cpu) ...@@ -4994,14 +4997,6 @@ static void unbind_workers(int cpu)
mutex_unlock(&wq_pool_attach_mutex); mutex_unlock(&wq_pool_attach_mutex);
/*
* Call schedule() so that we cross rq->lock and thus can
* guarantee sched callbacks see the %WORKER_UNBOUND flag.
* This is necessary as scheduler callbacks may be invoked
* from other cpus.
*/
schedule();
/* /*
* Sched callbacks are disabled now. Zap nr_running. * Sched callbacks are disabled now. Zap nr_running.
* After this, nr_running stays zero and need_more_worker() * After this, nr_running stays zero and need_more_worker()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment