]> bbs.cooldavid.org Git - net-next-2.6.git/commit - include/asm-generic/local.h
[PATCH] Decrapify asm-generic/local.h
authorKyle McMartin <kyle@parisc-linux.org>
Tue, 28 Mar 2006 09:56:11 +0000 (01:56 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 28 Mar 2006 17:16:01 +0000 (09:16 -0800)
commitf5f5370da4b3128b7dfd944b4fcbb5c7b6887348
tree45a00ae5b234648083bad84db213da3b8220b679
parent4f3a36a7d0eb420471506fcd46ee46f4b5cd4ebc
[PATCH] Decrapify asm-generic/local.h

Now that Christoph Lameter's atomic_long_t support is merged in mainline,
might as well convert asm-generic/local.h to use it, so the same code can
be used for both sizes of 32 and 64-bit unsigned longs.

akpm sayeth:

Q:

  Is there any particular reason why these routines weren't simply
  implemented with local_save/restore_flags, if they are only meant to
  guarantee atomicity to the local cpu?  I'm sure on most platforms this
  would be more efficient than using an atomic...

A:

  The whole _point_ of local_t is to avoid local_irq_disable().  It's
  designed to exploit the fact that many CPUs can do incs and decs in a way
  which is atomic wrt local interrupts, but not atomic wrt SMP.

But this patch makes sense, because asm-generic/local.h is just a fallback
implementation for architectures which either cannot perform these
local-irq-atomic operations, or its maintainers haven't yet got around to
implementing them.

We need more work done on local_t in the 2.6.17 timeframe - they're defined as
unsigned long, but some architectures implement them as signed long.

Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-generic/local.h