Re: [PATCH RFC v1] random: implement getrandom() in vDSO

From: Jeffrey Walton
Date: Thu Aug 04 2022 - 12:08:19 EST


On Thu, Aug 4, 2022 at 11:40 AM Jason A. Donenfeld <Jason@xxxxxxxxx> wrote:
>
> On Wed, Aug 03, 2022 at 12:27:43AM +0200, Thomas Gleixner wrote:
> > Jason!
>
> ...
> > Vs. the storage problem. That yells TLS, but that makes your process
> > wide sharing moot, which might not be the worst of all things IMO.
>
> Yea, TLS is what we want here. The `void *state` argument thing is meant
> for this. You allocate an array of states using that alloc function, and
> then you divvy them up per-thread.

I think it would be wise to give each thread its own state. It will
simplify locking and help avoid contention.

Jeff