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
misguided.

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..

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/