workqueue: introduce NR_WORKER_POOLS and for_each_worker_pool()
authorTejun Heo <tj@kernel.org>
Sat, 14 Jul 2012 05:16:44 +0000 (22:16 -0700)
committerTejun Heo <tj@kernel.org>
Sat, 14 Jul 2012 05:16:44 +0000 (22:16 -0700)
commit4ce62e9e30cacc26885cab133ad1de358dd79f21
tree6b08a377a236f0e44f335f7813d3da58a7ee1c70
parent11ebea50dbc1ade5994b2c838a096078d4c02399
workqueue: introduce NR_WORKER_POOLS and for_each_worker_pool()

Introduce NR_WORKER_POOLS and for_each_worker_pool() and convert code
paths which need to manipulate all pools in a gcwq to use them.
NR_WORKER_POOLS is currently one and for_each_worker_pool() iterates
over only @gcwq->pool.

Note that nr_running is per-pool property and converted to an array
with NR_WORKER_POOLS elements and renamed to pool_nr_running.  Note
that get_pool_nr_running() currently assumes 0 index.  The next patch
will make use of non-zero index.

The changes in this patch are mechanical and don't caues any
functional difference.  This is to prepare for multiple pools per
gcwq.

v2: nr_running indexing bug in get_pool_nr_running() fixed.

v3: Pointer to array is stupid.  Don't use it in get_pool_nr_running()
    as suggested by Linus.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
kernel/workqueue.c