From: KOSAKI Motohiro Date: Mon, 12 May 2008 21:02:06 +0000 (-0700) Subject: make vmstat cpu-unplug safe X-Git-Tag: v2.6.26-rc3~104 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5be11329f8cb2cc1a4c3b33b6b8d096c6012895;p=linux-2.6 make vmstat cpu-unplug safe When accessing cpu_online_map, we should prevent dynamic changing of cpu_online_map by get_online_cpus(). Unfortunately, all_vm_events() doesn't do that. Signed-off-by: KOSAKI Motohiro Acked-by: Christoph Lameter Cc: Gautham R Shenoy Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/vmstat.c b/mm/vmstat.c index 1a32130b95..db9eabb2c5 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -41,7 +41,9 @@ static void sum_vm_events(unsigned long *ret, cpumask_t *cpumask) */ void all_vm_events(unsigned long *ret) { + get_online_cpus(); sum_vm_events(ret, &cpu_online_map); + put_online_cpus(); } EXPORT_SYMBOL_GPL(all_vm_events);