Re: [PATCH 9/9] random: simplify accounting code

From: Greg Price
Date: Fri Dec 06 2013 - 13:25:20 EST


On Thu, Dec 05, 2013 at 08:13:47PM -0500, Theodore Ts'o wrote:
> On Wed, Nov 13, 2013 at 03:08:41AM -0500, Greg Price wrote:
> > + 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.

Sure, that'd be reasonable. I didn't do that mainly because I wanted
to preserve existing behavior wherever possible in these cleanups, to
make them easy to read and review.

Greg

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