[lkml]   [2013]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 9/9] random: simplify accounting code
On Wed, Nov 13, 2013 at 03:08:41AM -0500, Greg Price wrote:
> + entropy_count = max_t(int, 0,
> + entropy_count - (ibytes << (ENTROPY_SHIFT + 3)));
> + if (ibytes && cmpxchg(&r->entropy_count, orig, entropy_count) != orig)
> + goto retry;

I wonder if we would be better dropping the test for ibytes here, so
the above condition reads:

if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig)
goto retry;

It further simplifies the code, and it means that if we it turns out
that ibytes is zero (meaning there was no entropy available) but some
additional entropy comes in, we might acutally end up retrying and
successfully grabbing that entropy for the caller.

- Ted

 \ /
  Last update: 2013-12-06 17:21    [W:0.242 / U:0.780 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site