From 6a70f3eac1abe53d879171d76941db6a87b3ed09 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Thu, 3 Apr 2008 14:07:02 -0700 Subject: [PATCH] --- yaml --- r: 88178 b: refs/heads/master c: 61407f80f72970d52d4339f81c6c3cd03f4ca0f0 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/lib/random32.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 4c741df226d3..8221d6b2d101 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 84f59370c519449c70dcc813b050f5cbbf0098e7 +refs/heads/master: 61407f80f72970d52d4339f81c6c3cd03f4ca0f0 diff --git a/trunk/lib/random32.c b/trunk/lib/random32.c index ec7f81d3fb18..ca87d86992bd 100644 --- a/trunk/lib/random32.c +++ b/trunk/lib/random32.c @@ -97,13 +97,18 @@ EXPORT_SYMBOL(random32); * @seed: seed value * * Add some additional seeding to the random32() pool. - * Note: this pool is per cpu so it only affects current CPU. */ void srandom32(u32 entropy) { - struct rnd_state *state = &get_cpu_var(net_rand_state); - __set_random32(state, state->s1 ^ entropy); - put_cpu_var(state); + int i; + /* + * No locking on the CPUs, but then somewhat random results are, well, + * expected. + */ + for_each_possible_cpu (i) { + struct rnd_state *state = &per_cpu(net_rand_state, i); + __set_random32(state, state->s1 ^ entropy); + } } EXPORT_SYMBOL(srandom32);