All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6/7] Simple Performance Counters: Reclaim instrumentation
@ 2007-07-31 23:25 Christoph Lameter
  0 siblings, 0 replies; only message in thread
From: Christoph Lameter @ 2007-07-31 23:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: Christoph Lameter

Add some performance counters that display the performance
of memory reclaim (both direct and background)

Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
 include/linux/perf.h |    4 ++++
 kernel/perf.c        |    6 +++++-
 mm/vmscan.c          |   13 +++++++++++++
 3 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/include/linux/perf.h b/include/linux/perf.h
index 795b7ec..2dfc497 100644
--- a/include/linux/perf.h
+++ b/include/linux/perf.h
@@ -16,6 +16,10 @@
 enum pc_item {
 	PC_UPDATE_PROCESS_TIMES,
 	PC_ALLOC_PAGES,
+	PC_DIRECT_RECLAIM_SCANNED,
+	PC_DIRECT_RECLAIM_RECLAIMED,
+	PC_RECLAIM_SCANNED,
+	PC_RECLAIM_RECLAIMED,
 	NR_PC_ITEMS
 };
 
diff --git a/kernel/perf.c b/kernel/perf.c
index dd4e850..ecb768b 100644
--- a/kernel/perf.c
+++ b/kernel/perf.c
@@ -22,7 +22,11 @@ static int unsynced_get_cycles = 1;
 
 const char *var_id[NR_PC_ITEMS] = {
 	"update_process_times",
-	"__alloc_pages"
+	"__alloc_pages",
+	"direct_reclaim_scanned",
+	"direct_reclaim_reclaimed",
+	"reclaim_scanned",
+	"reclaim_reclaimed",
 };
 
 struct perf_counter {
diff --git a/mm/vmscan.c b/mm/vmscan.c
index d419e10..2836317 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -37,6 +37,7 @@
 #include <linux/delay.h>
 #include <linux/kthread.h>
 #include <linux/freezer.h>
+#include <linux/perf.h>
 
 #include <asm/tlbflush.h>
 #include <asm/div64.h>
@@ -1118,6 +1119,8 @@ static unsigned long shrink_zones(int priority, struct zone **zones,
  */
 unsigned long try_to_free_pages(struct zone **zones, int order, gfp_t gfp_mask)
 {
+	INIT_PC(pc_scanned);
+	INIT_PC(pc_reclaimed);
 	int priority;
 	int ret = 0;
 	unsigned long total_scanned = 0;
@@ -1200,6 +1203,10 @@ out:
 
 		zone->prev_priority = priority;
 	}
+	pc_bytes(&pc_scanned, PAGE_SIZE * sc.nr_scanned,
+				PC_DIRECT_RECLAIM_SCANNED);
+	pc_bytes(&pc_reclaimed, PAGE_SIZE * nr_reclaimed,
+				PC_DIRECT_RECLAIM_RECLAIMED);
 	return ret;
 }
 
@@ -1226,6 +1233,8 @@ out:
  */
 static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
 {
+	INIT_PC(pc_reclaim_scanned);
+	INIT_PC(pc_reclaim_reclaimed);
 	int all_zones_ok;
 	int priority;
 	int i;
@@ -1376,6 +1385,10 @@ out:
 		goto loop_again;
 	}
 
+	pc_bytes(&pc_reclaim_scanned, total_scanned * PAGE_SIZE,
+						PC_RECLAIM_SCANNED);
+	pc_bytes(&pc_reclaim_reclaimed, nr_reclaimed * PAGE_SIZE,
+						PC_RECLAIM_RECLAIMED);
 	return nr_reclaimed;
 }
 
-- 
1.5.2.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-31 23:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-31 23:25 [PATCH 6/7] Simple Performance Counters: Reclaim instrumentation Christoph Lameter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.