random: Make input to output pool balancing per cpu

The load balancing from input pool to output pools was
essentially unlocked. Before it didn't matter much because
there were only two choices (blocking and non blocking).

But now with the distributed non blocking pools we have
a lot more pools, and unlocked access of the counters
may systematically deprive some nodes from their deserved
entropy.

Turn the round-robin state into per CPU variables
to avoid any possibility of races. This code already
runs with preemption disabled.

v2: Check for non initialized pools.
v3: Make per cpu variables global to avoid warnings in some
configurations (0day)

Signed-off-by: Andi Kleen <ak@linux.intel.com>

squash! Make /dev/urandom scalable
1 file changed