]> bbs.cooldavid.org Git - net-next-2.6.git/commit
workqueue: fix how cpu number is stored in work->data
authorTejun Heo <tj@kernel.org>
Thu, 22 Jul 2010 12:14:25 +0000 (14:14 +0200)
committerTejun Heo <tj@kernel.org>
Thu, 22 Jul 2010 20:39:22 +0000 (22:39 +0200)
commite120153ddf8620fd0a194d301e9c5a8b28483bb5
tree953ef1a61ca29d0486a6c8c3bb72dd8bbc080419
parentf2e005aaff4878a8ea93d5fb033a21389b72579a
workqueue: fix how cpu number is stored in work->data

Once a work starts execution, its data contains the cpu number it was
on instead of pointing to cwq.  This is added by commit 7a22ad75
(workqueue: carry cpu number in work data once execution starts) to
reliably determine the work was last on even if the workqueue itself
was destroyed inbetween.

Whether data points to a cwq or contains a cpu number was
distinguished by comparing the value against PAGE_OFFSET.  The
assumption was that a cpu number should be below PAGE_OFFSET while a
pointer to cwq should be above it.  However, on architectures which
use separate address spaces for user and kernel spaces, this doesn't
hold as PAGE_OFFSET is zero.

Fix it by using an explicit flag, WORK_STRUCT_CWQ, to mark what the
data field contains.  If the flag is set, it's pointing to a cwq;
otherwise, it contains a cpu number.

Reported on s390 and microblaze during linux-next testing.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Sachin Sant <sachinp@in.ibm.com>
Reported-by: Michal Simek <michal.simek@petalogix.com>
Reported-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Tested-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Tested-by: Michal Simek <monstr@monstr.eu>
include/linux/workqueue.h
kernel/workqueue.c