diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2013-02-19 20:17:02 (GMT) |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-03-04 17:44:58 (GMT) |
commit | b31041042a8cdece67f925e4bae55b5f5fd754ca (patch) | |
tree | 6392271c537c05d59e0d72ac72463343d2a29249 /kernel/workqueue.c | |
parent | f36dc67b27a689eeb3631b11ebef17bbff257fbb (diff) | |
download | linux-b31041042a8cdece67f925e4bae55b5f5fd754ca.tar.xz |
workqueue: better define synchronization rule around rescuer->pool updates
Rescuers visit different worker_pools to process work items from pools
under pressure. Currently, rescuer->pool is updated outside any
locking and when an outsider looks at a rescuer, there's no way to
tell when and whether rescuer->pool is gonna change. While this
doesn't currently cause any problem, it is nasty.
With recent worker_maybe_bind_and_lock() changes, we can move
rescuer->pool updates inside pool locks such that if rescuer->pool
equals a locked pool, it's guaranteed to stay that way until the pool
is unlocked.
Move rescuer->pool inside pool->lock.
This patch doesn't introduce any visible behavior difference.
tj: Updated the description.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 09545d4..fd9a28a 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -2357,8 +2357,8 @@ repeat: mayday_clear_cpu(cpu, wq->mayday_mask); /* migrate to the target cpu if possible */ - rescuer->pool = pool; worker_maybe_bind_and_lock(pool); + rescuer->pool = pool; /* * Slurp in all works issued via this workqueue and @@ -2379,6 +2379,7 @@ repeat: if (keep_working(pool)) wake_up_worker(pool); + rescuer->pool = NULL; spin_unlock_irq(&pool->lock); } |