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

Anton Blanchard via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 23:18:56 PDT 2015


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: urandom.patch
Type: text/x-patch
Size: 763 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150909/3c05f1ab/attachment.bin>


More information about the llvm-commits mailing list