]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
workqueue: update synchronization rules on worker_pool_idr
authorTejun Heo <tj@kernel.org>
Tue, 12 Mar 2013 18:30:00 +0000 (11:30 -0700)
committerTejun Heo <tj@kernel.org>
Tue, 12 Mar 2013 18:30:00 +0000 (11:30 -0700)
commitfa1b54e69bc6c04674c9bb96a6cfa8b2c9f44771
treed04342a5015b1b88fdefeceabdb1f26479dcff65
parent76af4d936153afec176c53378e6ba8671e7e237d
workqueue: update synchronization rules on worker_pool_idr

Make worker_pool_idr protected by workqueue_lock for writes and
sched-RCU protected for reads.  Lockdep assertions are added to
for_each_pool() and get_work_pool() and all their users are converted
to either hold workqueue_lock or disable preemption/irq.

worker_pool_assign_id() is updated to hold workqueue_lock when
allocating a pool ID.  As idr_get_new() always performs RCU-safe
assignment, this is enough on the writer side.

As standard pools are never destroyed, there's nothing to do on that
side.

The locking is superflous at this point.  This is to help
implementation of unbound pools/pwqs with custom attributes.

This patch doesn't introduce any behavior changes.

v2: Updated for_each_pwq() use if/else for the hidden assertion
    statement instead of just if as suggested by Lai.  This avoids
    confusing the following else clause.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
kernel/workqueue.c