[PATCH] Support: Avoid buffered reads of /dev/urandom

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 06:14:25 PDT 2015


Would it be best to just use open/read/close instead of fopen/fread/fclose?

On 9 September 2015 at 02:18, Anton Blanchard via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> I am seeing disappointing clang performance on a large PowerPC64
> Linux box. GetRandomNumberSeed() does a buffered read from
> /dev/urandom to seed its PRNG. As a result we read an entire page
> even though we only need 4 bytes.
>
> With every clang task reading a page worth of /dev/urandom we
> end up spending a large amount of time stuck on kernel spinlock.
>
> Fix this by disabling buffering.
>
> Anton
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>


More information about the llvm-commits mailing list