mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 07:01:23 +00:00
[PATCH] percpu data: only iterate over possible CPUs
percpu_data blindly allocates bootmem memory to store NR_CPUS instances of cpudata, instead of allocating memory only for possible cpus. As a preparation for changing that, we need to convert various 0 -> NR_CPUS loops to use for_each_cpu(). (The above only applies to users of asm-generic/percpu.h. powerpc has gone it alone and is presently only allocating memory for present CPUs, so it's currently corrupting memory). Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: James Bottomley <James.Bottomley@steeleye.com> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: Jens Axboe <axboe@suse.de> Cc: Anton Blanchard <anton@samba.org> Acked-by: William Irwin <wli@holomorphy.com> Cc: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
cef5076987
commit
88a2a4ac6b
11 changed files with 17 additions and 16 deletions
|
@ -121,7 +121,7 @@ void __init net_random_init(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NR_CPUS; i++) {
|
||||
for_each_cpu(i) {
|
||||
struct nrnd_state *state = &per_cpu(net_rand_state,i);
|
||||
__net_srandom(state, i+jiffies);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ static int net_random_reseed(void)
|
|||
unsigned long seed[NR_CPUS];
|
||||
|
||||
get_random_bytes(seed, sizeof(seed));
|
||||
for (i = 0; i < NR_CPUS; i++) {
|
||||
for_each_cpu(i) {
|
||||
struct nrnd_state *state = &per_cpu(net_rand_state,i);
|
||||
__net_srandom(state, seed[i]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue