Re: [PATCH] one of $BIGNUM devfs races

From: Richard Gooch (rgooch@ras.ucalgary.ca)
Date: Tue Aug 07 2001 - 12:09:16 EST


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/



This archive was generated by hypermail 2b29 : Tue Aug 07 2001 - 21:00:46 EST