Re: [PATCH] move xchg/cmpxchg to atomic.h

Roman Zippel (
Tue, 2 Jan 2001 21:44:42 +0100 (MET)


On Tue, 2 Jan 2001, David S. Miller wrote:

> We really can't. We _only_ have load-and-zero. And it has to be
> 16-byte aligned. xchg() is just not something the CPU implements.
> Oh bugger... you do have real problems.

For 2.5 we could move all the atomic functions from atomic.h, bitops.h,
system.h and give them a common interface. We could also give them a new
argument atomic_spinlock_t, which is a normal spinlock, but only used on
architectures which need it, everyone else can "optimize" it away. I think
one such lock per major subsystem should be enough, as the lock is only
held for a very short time, so contentation should be no problem.
Anyway, this had the huge advantage that we could use the complete 32/64
bit of the atomic value, e.g. for pointer operations.

bye, Roman

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at