workqueue: implement and use pwq_adjust_max_active()
authorTejun Heo <tj@kernel.org>
Wed, 13 Mar 2013 23:51:35 +0000 (16:51 -0700)
committerTejun Heo <tj@kernel.org>
Wed, 13 Mar 2013 23:51:35 +0000 (16:51 -0700)
commit699ce097efe8f45bc5c055e4f12cb1e271c270d9
treedb116c908ed97eaf621c4dc99a4896acd51e56a2
parent0fbd95aa8a056194933fba4ae78c50fc20f0704e
workqueue: implement and use pwq_adjust_max_active()

Rename pwq_set_max_active() to pwq_adjust_max_active() and move
pool_workqueue->max_active synchronization and max_active
determination logic into it.

The new function should be called with workqueue_lock held for stable
workqueue->saved_max_active, determines the current max_active value
the target pool_workqueue should be using from @wq->saved_max_active
and the state of the associated pool, and applies it with proper
synchronization.

The current two users - workqueue_set_max_active() and
thaw_workqueues() - are updated accordingly.  In addition, the manual
freezing handling in __alloc_workqueue_key() and
freeze_workqueues_begin() are replaced with calls to
pwq_adjust_max_active().

This centralizes max_active handling so that it's less error-prone.

Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c