lkml.org 
[lkml]   [2012]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH 02/10] random: use lockless techniques when mixing entropy pools
    On Thu, Jul 5, 2012 at 11:12 AM, Theodore Ts'o <tytso@mit.edu> 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
    instead.

    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.

    Linus


    \
     
     \ /
      Last update: 2012-07-05 21:01    [W:0.022 / U:2.168 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site