summaryrefslogtreecommitdiffstats
path: root/mm/vmstat.c
diff options
context:
space:
mode:
authorToshi Kani <toshi.kani@hp.com>2013-11-12 15:08:13 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 12:09:09 +0900
commit807a1bd2b2a38845fd422b93328e7d69f13eb13a (patch)
tree355479f5a20d1ed71261bd9071583651e5983f4e /mm/vmstat.c
parentd7e0b37a87c39f5c02dd7b5d55c7a3ec2f65b943 (diff)
downloadlinux-stable-807a1bd2b2a38845fd422b93328e7d69f13eb13a.tar.gz
linux-stable-807a1bd2b2a38845fd422b93328e7d69f13eb13a.tar.bz2
linux-stable-807a1bd2b2a38845fd422b93328e7d69f13eb13a.zip
mm: clear N_CPU from node_states at CPU offline
vmstat_cpuup_callback() is a CPU notifier callback, which marks N_CPU to a node at CPU online event. However, it does not update this N_CPU info at CPU offline event. Changed vmstat_cpuup_callback() to clear N_CPU when the last CPU in the node is put into offline, i.e. the node no longer has any online CPU. 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/vmstat.c')
-rw-r--r--mm/vmstat.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 0a1f7de972b3..b6d17edf8cf3 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1229,6 +1229,20 @@ static void start_cpu_timer(int cpu)
schedule_delayed_work_on(cpu, work, __round_jiffies_relative(HZ, cpu));
}
+static void vmstat_cpu_dead(int node)
+{
+ int cpu;
+
+ get_online_cpus();
+ for_each_online_cpu(cpu)
+ if (cpu_to_node(cpu) == node)
+ goto end;
+
+ node_clear_state(node, N_CPU);
+end:
+ put_online_cpus();
+}
+
/*
* Use the cpu notifier to insure that the thresholds are recalculated
* when necessary.
@@ -1258,6 +1272,7 @@ static int vmstat_cpuup_callback(struct notifier_block *nfb,
case CPU_DEAD:
case CPU_DEAD_FROZEN:
refresh_zone_stat_thresholds();
+ vmstat_cpu_dead(cpu_to_node(cpu));
break;
default:
break;