diff options
| author | Vinayak Menon <vinmenon@codeaurora.org> | 2015-03-26 11:58:45 +0530 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:03:54 -0700 |
| commit | 3086328d5ff69cee18399a68dd9fd9c5f10a4c2d (patch) | |
| tree | 8f865af55b3d8221a897248b0329cc46a2f7fda0 /include/linux | |
| parent | d487a9f1f7291870ebeac3bc243f9fe65dcdfefb (diff) | |
mm: page-writeback: fix page state calculation in throttle_vm_writeout
It was found that a number of tasks were blocked in the reclaim path
(throttle_vm_writeout) for seconds, because of vmstat_diff not being
synced in time. Fix that by adding a new function
global_page_state_snapshot.
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Change-Id: Iec167635ad724a55c27bdbd49eb8686e7857216c
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/vmstat.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 3e5d9075960f..aed05ca3e911 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -160,6 +160,26 @@ static inline unsigned long zone_page_state_snapshot(struct zone *zone, return x; } +static inline unsigned long global_page_state_snapshot(enum zone_stat_item item) +{ + long x = atomic_long_read(&vm_stat[item]); + +#ifdef CONFIG_SMP + struct zone *zone; + int cpu; + + for_each_online_cpu(cpu) { + for_each_populated_zone(zone) + x += per_cpu_ptr(zone->pageset, + cpu)->vm_stat_diff[item]; + } + + if (x < 0) + x = 0; +#endif + return x; +} + #ifdef CONFIG_NUMA extern unsigned long node_page_state(int node, enum zone_stat_item item); |
