[lkml]   [2012]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 02/10] random: use lockless techniques when mixing entropy pools
On Thu, Jul 5, 2012 at 11:12 AM, Theodore Ts'o <> wrote:
> Also, we will use a trylock when trying to increase then entropy
> accounting during the interrupt path to avoid taking a spinlock there;
> if there is contention, we will simply not credit the entropy count,
> thus failing safe. Thanks to Dan Carpenter for suggesting this
> approach.

Actually, I hate that. If the *only* thing the spinlock protects is
that entropy count, then use one single cmpxchg() for that field

The trylock means that now you need to disable interrupts etc. Just
don't do it. Do things entirely locklessly, and minimizing atomics.
Quite frankly, I think that protecting the entropy count is completely
idiotic, since it's not "real" in any form anyway, but if you
absolutely have to, a single cmpxchg is much better than playing games
with spinlocks and interrupt disables.


 \ /
  Last update: 2012-07-05 21:01    [W:0.220 / U:32.720 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site