[lkml]   [2012]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 06/10] random: use the arch-specific rng in xfer_secondary_pool
On Thu, Jul 5, 2012 at 11:12 AM, Theodore Ts'o <> wrote:
> If the CPU supports a hardware random number generator, use it in
> xfer_secondary_pool(), where it will significantly improve things and
> where we can afford it.

Ok, this makes the other patch look much better, in that hopefully
"get_random_bytes()" at least is guaranteed to use the hw randomness.

HOWEVER, it does look a bit bogus. Why use "arch_get_random_int()",
when "arch_get_random_long()" gives you potentially twice the amount
at the same cost? Also, you already have a 128-byte array on the stack
(tmp[]), please don't make the stack cost of this thing even bigger.
Use a "union" to hold both tmp[] and hwrand[] without growing the
stack unnecessarily.

Also, you should not use "cycle_t cycles" - your changes to the struct
are not an improvement. The high bits of "cycles" have no actual
randomness in them, and you're just making things more expensive for
no reason. At least on x86, the low 32 bits of the cycles are cheaper
than the whole 64-bit value. So using more bits guys you nothing, and
only makes the code slower.


 \ /
  Last update: 2012-07-05 21:41    [W:0.193 / U:3.728 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site