aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorToshi Kani <toshi.kani@hp.com>2013-11-12 18:08:12 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 22:09:09 -0500
commitd7e0b37a87c39f5c02dd7b5d55c7a3ec2f65b943 (patch)
tree15ded33cf0301497fa2dadf03bbb72f338596ac9 /mm
parentc5320926e370b4cfb8f10c2169e26f960079cf67 (diff)
mm: set N_CPU to node_states during boot
After a system booted, N_CPU is not set to any node as has_cpu shows an empty line. # cat /sys/devices/system/node/has_cpu (show-empty-line) setup_vmstat() registers its CPU notifier callback, vmstat_cpuup_callback(), which marks N_CPU to a node when a CPU is put into online. However, setup_vmstat() is called after all CPUs are launched in the boot sequence. Changed setup_vmstat() to mark N_CPU to the nodes with online CPUs at boot, which is consistent with other operations in vmstat_cpuup_callback(), i.e. start_cpu_timer() and refresh_zone_stat_thresholds(). Also added get_online_cpus() to protect the for_each_online_cpu() loop. Signed-off-by: Toshi Kani <toshi.kani@hp.com> Acked-by: Christoph Lameter <cl@linux.com> Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Tested-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmstat.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 9bb314577911..0a1f7de972b3 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1276,8 +1276,12 @@ static int __init setup_vmstat(void)
1276 1276
1277 register_cpu_notifier(&vmstat_notifier); 1277 register_cpu_notifier(&vmstat_notifier);
1278 1278
1279 for_each_online_cpu(cpu) 1279 get_online_cpus();
1280 for_each_online_cpu(cpu) {
1280 start_cpu_timer(cpu); 1281 start_cpu_timer(cpu);
1282 node_set_state(cpu_to_node(cpu), N_CPU);
1283 }
1284 put_online_cpus();
1281#endif 1285#endif
1282#ifdef CONFIG_PROC_FS 1286#ifdef CONFIG_PROC_FS
1283 proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); 1287 proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations);