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 <[email protected]>
Acked-by: Christoph Lameter <[email protected]>
Cc: Gautham R Shenoy <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
KOSAKI Motohiro 2008-05-12 14:02:06 -07:00 • committed by Linus Torvalds
commit b5be11329f

View file

@ -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);