workqueue: record pool ID instead of CPU in work->data when off-queue
authorTejun Heo <tj@kernel.org>
Thu, 24 Jan 2013 19:01:33 +0000 (11:01 -0800)
committerTejun Heo <tj@kernel.org>
Thu, 24 Jan 2013 19:01:33 +0000 (11:01 -0800)
commit7c3eed5cd60d0f736516e6ade77d90c6255860bd
treebfc017307b98a4db8c919ba9fb53399189ecf0ad
parent9daf9e678d18585433a4ad90ec51a448e5fd054c
workqueue: record pool ID instead of CPU in work->data when off-queue

Currently, when a work item is off-queue, work->data records the CPU
it was last on, which is used to locate the last executing instance
for non-reentrance, flushing, etc.

We're in the process of removing global_cwq and making worker_pool the
top level abstraction.  This patch makes work->data point to the pool
it was last associated with instead of CPU.

After the previous WORK_OFFQ_POOL_CPU and worker_poo->id additions,
the conversion is fairly straight-forward.  WORK_OFFQ constants and
functions are modified to record and read back pool ID instead.
worker_pool_by_id() is added to allow looking up pool from ID.
get_work_pool() replaces get_work_gcwq(), which is reimplemented using
get_work_pool().  get_work_pool_id() replaces work_cpu().

This patch shouldn't introduce any observable behavior changes.

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