diff options
| author | Dave Airlie <airlied@redhat.com> | 2010-09-24 15:37:33 +1000 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2010-09-24 15:37:33 +1000 |
| commit | 4a445f291ac3faa08f56eaeb6e44856b6b72b74c (patch) | |
| tree | b66cc93311dc4c623113a87aa9b40730a21ac18e /include/linux/vmstat.h | |
| parent | cbc60ca04b342a4e1f2a1086a7277c077f07dbed (diff) | |
| parent | a850ea30374ebed32a0724742601861853fde869 (diff) | |
Merge remote branch 'origin/master' of /home/airlied/kernel//linux-2.6 into drm-core-next
Diffstat (limited to 'include/linux/vmstat.h')
| -rw-r--r-- | include/linux/vmstat.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 7f43ccdc1d38..eaaea37b3b75 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -170,6 +170,28 @@ static inline unsigned long zone_page_state(struct zone *zone, return x; } +/* + * More accurate version that also considers the currently pending + * deltas. For that we need to loop over all cpus to find the current + * deltas. There is no synchronization so the result cannot be + * exactly accurate either. + */ +static inline unsigned long zone_page_state_snapshot(struct zone *zone, + enum zone_stat_item item) +{ + long x = atomic_long_read(&zone->vm_stat[item]); + +#ifdef CONFIG_SMP + int cpu; + for_each_online_cpu(cpu) + x += per_cpu_ptr(zone->pageset, cpu)->vm_stat_diff[item]; + + if (x < 0) + x = 0; +#endif + return x; +} + extern unsigned long global_reclaimable_pages(void); extern unsigned long zone_reclaimable_pages(struct zone *zone); |
