Skip to content

Commit

Permalink
[S390] cpuinfo: use get_online_cpus() instead of preempt_disable()
Browse files Browse the repository at this point in the history
Use get_online_cpus() instead of preempt_disable() to make sure cpus
don't go offline while accessing their per cpu data.
The preempt_disable() stuff is old code which was used before
get_online_cpus() was available.

Signed-off-by: Heiko Carstens <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
  • Loading branch information
heicarst authored and Martin Schwidefsky committed Jan 5, 2011
1 parent 974de4d commit 19726ce
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions arch/s390/kernel/processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <linux/smp.h>
#include <linux/seq_file.h>
#include <linux/delay.h>

#include <linux/cpu.h>
#include <asm/elf.h>
#include <asm/lowcore.h>
#include <asm/param.h>
Expand Down Expand Up @@ -47,7 +47,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
int i;

s390_adjust_jiffies();
preempt_disable();
if (!n) {
seq_printf(m, "vendor_id : IBM/S390\n"
"# processors : %i\n"
Expand All @@ -60,7 +59,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_printf(m, "%s ", hwcap_str[i]);
seq_puts(m, "\n");
}

get_online_cpus();
if (cpu_online(n)) {
struct cpuid *id = &per_cpu(cpu_id, n);
seq_printf(m, "processor %li: "
Expand All @@ -69,7 +68,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
"machine = %04X\n",
n, id->version, id->ident, id->machine);
}
preempt_enable();
put_online_cpus();
return 0;
}

Expand Down

0 comments on commit 19726ce

Please sign in to comment.