aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/vmstat.h4
-rw-r--r--mm/page_alloc.c7
-rw-r--r--mm/vmstat.c12
3 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index a5bb15018b5c..92a86b2cce33 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -198,6 +198,8 @@ extern void __dec_zone_state(struct zone *, enum zone_stat_item);
198void refresh_cpu_vm_stats(int); 198void refresh_cpu_vm_stats(int);
199void refresh_zone_stat_thresholds(void); 199void refresh_zone_stat_thresholds(void);
200 200
201void drain_zonestat(struct zone *zone, struct per_cpu_pageset *);
202
201int calculate_pressure_threshold(struct zone *zone); 203int calculate_pressure_threshold(struct zone *zone);
202int calculate_normal_threshold(struct zone *zone); 204int calculate_normal_threshold(struct zone *zone);
203void set_pgdat_percpu_threshold(pg_data_t *pgdat, 205void set_pgdat_percpu_threshold(pg_data_t *pgdat,
@@ -251,6 +253,8 @@ static inline void __dec_zone_page_state(struct page *page,
251static inline void refresh_cpu_vm_stats(int cpu) { } 253static inline void refresh_cpu_vm_stats(int cpu) { }
252static inline void refresh_zone_stat_thresholds(void) { } 254static inline void refresh_zone_stat_thresholds(void) { }
253 255
256static inline void drain_zonestat(struct zone *zone,
257 struct per_cpu_pageset *pset) { }
254#endif /* CONFIG_SMP */ 258#endif /* CONFIG_SMP */
255 259
256static inline void __mod_zone_freepage_state(struct zone *zone, int nr_pages, 260static inline void __mod_zone_freepage_state(struct zone *zone, int nr_pages,
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9b8e6243a524..5485f0ef4ec3 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5916,6 +5916,7 @@ static int __meminit __zone_pcp_update(void *data)
5916 local_irq_save(flags); 5916 local_irq_save(flags);
5917 if (pcp->count > 0) 5917 if (pcp->count > 0)
5918 free_pcppages_bulk(zone, pcp->count, pcp); 5918 free_pcppages_bulk(zone, pcp->count, pcp);
5919 drain_zonestat(zone, pset);
5919 setup_pageset(pset, batch); 5920 setup_pageset(pset, batch);
5920 local_irq_restore(flags); 5921 local_irq_restore(flags);
5921 } 5922 }
@@ -5932,10 +5933,16 @@ void __meminit zone_pcp_update(struct zone *zone)
5932void zone_pcp_reset(struct zone *zone) 5933void zone_pcp_reset(struct zone *zone)
5933{ 5934{
5934 unsigned long flags; 5935 unsigned long flags;
5936 int cpu;
5937 struct per_cpu_pageset *pset;
5935 5938
5936 /* avoid races with drain_pages() */ 5939 /* avoid races with drain_pages() */
5937 local_irq_save(flags); 5940 local_irq_save(flags);
5938 if (zone->pageset != &boot_pageset) { 5941 if (zone->pageset != &boot_pageset) {
5942 for_each_online_cpu(cpu) {
5943 pset = per_cpu_ptr(zone->pageset, cpu);
5944 drain_zonestat(zone, pset);
5945 }
5939 free_percpu(zone->pageset); 5946 free_percpu(zone->pageset);
5940 zone->pageset = &boot_pageset; 5947 zone->pageset = &boot_pageset;
5941 } 5948 }
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 05e3a9913744..2f11309955cc 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -495,6 +495,18 @@ void refresh_cpu_vm_stats(int cpu)
495 atomic_long_add(global_diff[i], &vm_stat[i]); 495 atomic_long_add(global_diff[i], &vm_stat[i]);
496} 496}
497 497
498void drain_zonestat(struct zone *zone, struct per_cpu_pageset *pset)
499{
500 int i;
501
502 for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
503 if (pset->vm_stat_diff[i]) {
504 int v = pset->vm_stat_diff[i];
505 pset->vm_stat_diff[i] = 0;
506 atomic_long_add(v, &zone->vm_stat[i]);
507 atomic_long_add(v, &vm_stat[i]);
508 }
509}
498#endif 510#endif
499 511
500#ifdef CONFIG_NUMA 512#ifdef CONFIG_NUMA