summaryrefslogtreecommitdiffstats
path: root/include/linux/vmstat.h
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2007-02-10 01:43:01 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 10:51:17 -0800
commitc878538598d1e7ab41ecc0de8894e34e2fdef630 (patch)
treed22e73fddef75521e287c3e7754a1d3224c348d9 /include/linux/vmstat.h
parentc3704ceb4ad055b489b143f4e37c57d128908012 (diff)
downloadlinux-stable-c878538598d1e7ab41ecc0de8894e34e2fdef630.tar.gz
linux-stable-c878538598d1e7ab41ecc0de8894e34e2fdef630.tar.bz2
linux-stable-c878538598d1e7ab41ecc0de8894e34e2fdef630.zip
[PATCH] Use ZVC for inactive and active counts
The determination of the dirty ratio to determine writeback behavior is currently based on the number of total pages on the system. However, not all pages in the system may be dirtied. Thus the ratio is always too low and can never reach 100%. The ratio may be particularly skewed if large hugepage allocations, slab allocations or device driver buffers make large sections of memory not available anymore. In that case we may get into a situation in which f.e. the background writeback ratio of 40% cannot be reached anymore which leads to undesired writeback behavior. This patchset fixes that issue by determining the ratio based on the actual pages that may potentially be dirty. These are the pages on the active and the inactive list plus free pages. The problem with those counts has so far been that it is expensive to calculate these because counts from multiple nodes and multiple zones will have to be summed up. This patchset makes these counters ZVC counters. This means that a current sum per zone, per node and for the whole system is always available via global variables and not expensive anymore to calculate. The patchset results in some other good side effects: - Removal of the various functions that sum up free, active and inactive page counts - Cleanup of the functions that display information via the proc filesystem. This patch: The use of a ZVC for nr_inactive and nr_active allows a simplification of some counter operations. More ZVC functionality is used for sums etc in the following patches. [akpm@osdl.org: UP build fix] Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/vmstat.h')
-rw-r--r--include/linux/vmstat.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 5e9803ed17fc..c8d55bcc09b9 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -186,6 +186,9 @@ void inc_zone_page_state(struct page *, enum zone_stat_item);
void dec_zone_page_state(struct page *, enum zone_stat_item);
extern void inc_zone_state(struct zone *, enum zone_stat_item);
+extern void __inc_zone_state(struct zone *, enum zone_stat_item);
+extern void dec_zone_state(struct zone *, enum zone_stat_item);
+extern void __dec_zone_state(struct zone *, enum zone_stat_item);
void refresh_cpu_vm_stats(int);
void refresh_vm_stats(void);
@@ -214,6 +217,12 @@ static inline void __inc_zone_page_state(struct page *page,
__inc_zone_state(page_zone(page), item);
}
+static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item)
+{
+ atomic_long_dec(&zone->vm_stat[item]);
+ atomic_long_dec(&vm_stat[item]);
+}
+
static inline void __dec_zone_page_state(struct page *page,
enum zone_stat_item item)
{