Re: [PATCH] one of $BIGNUM devfs races

Richard Gooch (rgooch@ras.ucalgary.ca)
Tue, 7 Aug 2001 11:09:16 -0600


Anton Altaparmakov writes:
> If you are introducing a spinlock for the sole purpose of protecting
> a counter, I would suggest to drop the spinlock, make the counter an
> atomic_t and just use atomic operations on it. That should be both
> faster and generate shorter code.

Firstly, I don't see an atomic_get_and_inc(). Sure, I can atomically
increment, and I can atomically read. But I can't read and increment
atomically.

Secondly, the range is 24 bits. While 24 bits is "probably enough",
I'd prefer not to waste bits.

Finally, a spinlock is less code (0) and faster on UP.

Regards,

Richard....
Permanent: rgooch@atnf.csiro.au
Current: rgooch@ras.ucalgary.ca
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/