aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmstat.c
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2012-10-19 07:00:10 -0400
committerMel Gorman <mgorman@suse.de>2012-12-11 09:28:35 -0500
commit397487db696cae0b026a474a5cd66f4e372995e6 (patch)
tree969d503374f9ff4788fe8d08873e8bc6e1a60630 /mm/vmstat.c
parent7b2a2d4a18fffac3c4872021529b0657896db788 (diff)
mm: compaction: Add scanned and isolated counters for compaction
Compaction already has tracepoints to count scanned and isolated pages but it requires that ftrace be enabled and if that information has to be written to disk then it can be disruptive. This patch adds vmstat counters for compaction called compact_migrate_scanned, compact_free_scanned and compact_isolated. With these counters, it is possible to define a basic cost model for compaction. This approximates of how much work compaction is doing and can be compared that with an oprofile showing TLB misses and see if the cost of compaction is being offset by THP for example. Minimally a compaction patch can be evaluated in terms of whether it increases or decreases cost. The basic cost model looks like this Fundamental unit u: a word sizeof(void *) Ca = cost of struct page access = sizeof(struct page) / u Cmc = Cost migrate page copy = (Ca + PAGE_SIZE/u) * 2 Cmf = Cost migrate failure = Ca * 2 Ci = Cost page isolation = (Ca + Wi) where Wi is a constant that should reflect the approximate cost of the locking operation. Csm = Cost migrate scanning = Ca Csf = Cost free scanning = Ca Overall cost = (Csm * compact_migrate_scanned) + (Csf * compact_free_scanned) + (Ci * compact_isolated) + (Cmc * pgmigrate_success) + (Cmf * pgmigrate_failed) Where the values are read from /proc/vmstat. This is very basic and ignores certain costs such as the allocation cost to do a migrate page copy but any improvement to the model would still use the same vmstat counters. Signed-off-by: Mel Gorman <mgorman@suse.de> Reviewed-by: Rik van Riel <riel@redhat.com>
Diffstat (limited to 'mm/vmstat.c')
-rw-r--r--mm/vmstat.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 89a7fd665b32..3a067fabe190 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -779,6 +779,9 @@ const char * const vmstat_text[] = {
779 "pgmigrate_fail", 779 "pgmigrate_fail",
780#endif 780#endif
781#ifdef CONFIG_COMPACTION 781#ifdef CONFIG_COMPACTION
782 "compact_migrate_scanned",
783 "compact_free_scanned",
784 "compact_isolated",
782 "compact_stall", 785 "compact_stall",
783 "compact_fail", 786 "compact_fail",
784 "compact_success", 787 "compact_success",