aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/vmstat.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c
index aaee66330e01..158ca6494bc6 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -414,6 +414,15 @@ void dec_zone_page_state(struct page *page, enum zone_stat_item item)
414EXPORT_SYMBOL(dec_zone_page_state); 414EXPORT_SYMBOL(dec_zone_page_state);
415#endif 415#endif
416 416
417static inline void fold_diff(int *diff)
418{
419 int i;
420
421 for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
422 if (diff[i])
423 atomic_long_add(diff[i], &vm_stat[i]);
424}
425
417/* 426/*
418 * Update the zone counters for the current cpu. 427 * Update the zone counters for the current cpu.
419 * 428 *
@@ -483,10 +492,7 @@ static void refresh_cpu_vm_stats(int cpu)
483 drain_zone_pages(zone, &p->pcp); 492 drain_zone_pages(zone, &p->pcp);
484#endif 493#endif
485 } 494 }
486 495 fold_diff(global_diff);
487 for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
488 if (global_diff[i])
489 atomic_long_add(global_diff[i], &vm_stat[i]);
490} 496}
491 497
492/* 498/*
@@ -516,9 +522,7 @@ void cpu_vm_stats_fold(int cpu)
516 } 522 }
517 } 523 }
518 524
519 for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++) 525 fold_diff(global_diff);
520 if (global_diff[i])
521 atomic_long_add(global_diff[i], &vm_stat[i]);
522} 526}
523 527
524/* 528/*