Re: [PATCH] keys: Discard key spinlock and use RCU for key payload

From: Linus Torvalds
Date: Wed Mar 09 2005 - 13:27:24 EST

On Wed, 9 Mar 2005, David Howells wrote:
> The attached patch changes the key implementation in a number of ways:
> (1) It removes the spinlock from the key structure.
> (2) The key flags are now accessed using atomic bitops instead of
> write-locking the key spinlock and using C bitwise operators.

I'd suggest against using __set_bit() for the initialization. Either use
the proper set_bit() (which is slow, but at least consistent), or just
initialize it with (1ul << KEY_FLAG_IN_QUOTA). __set_bit is generally
slower than setting a value (it's pretty guaranteed not to be faster, and
at least on x86 is clearly slower), so using it as an "optimization" is

RCU seems to fit the key model pretty well, but I still wonder whether the
conceptual complexity is worth it. Was this done on a whim, or was there
some real reason for it? I'd love for that to be documented while you're
at it..

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