Add some performance counters that display the performance
of memory reclaim (both direct and background)
Signed-off-by: Christoph Lameter <[email protected]>
---
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]