Make workqueue bit operations work on "atomic_long_t"
authorLinus Torvalds <torvalds@woody.osdl.org>
Sat, 16 Dec 2006 17:53:50 +0000 (09:53 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Sat, 16 Dec 2006 17:53:50 +0000 (09:53 -0800)
commita08727bae727fc2ca3a6ee9506d77786b71070b3
treeb1b42acea520c7738fc2e62476221a049f195f87
parent2f77d107050abc14bc393b34bdb7b91cf670c250
Make workqueue bit operations work on "atomic_long_t"

On architectures where the atomicity of the bit operations is handled by
external means (ie a separate spinlock to protect concurrent accesses),
just doing a direct assignment on the workqueue data field (as done by
commit 4594bf159f1962cec3b727954b7c598b07e2e737) can cause the
assignment to be lost due to lack of serialization with the bitops on
the same word.

So we need to serialize the assignment with the locks on those
architectures (notably older ARM chips, PA-RISC and sparc32).

So rather than using an "unsigned long", let's use "atomic_long_t",
which already has a safe assignment operation (atomic_long_set()) on
such architectures.

This requires that the atomic operations use the same atomicity locks as
the bit operations do, but that is largely the case anyway.  Sparc32
will probably need fixing.

Architectures (including modern ARM with LL/SC) that implement sane
atomic operations for SMP won't see any of this matter.

Cc: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: David Howells <dhowells@redhat.com>
Cc: David Miller <davem@davemloft.com>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Linux Arch Maintainers <linux-arch@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/workqueue.h
kernel/workqueue.c