From 597a9b59ad4032c6ba899fd6b4cec42ffe43ec2b Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Sat, 28 Jul 2007 12:35:30 -0700 Subject: [PATCH] Simple Performance Counters: __alloc_pages instrumentation Instrument __alloc_pages with a performance counter. Allows the investigation of various allocation scenarios on page allocator performance. Signed-off-by: Christoph Lameter --- include/linux/perf.h | 1 + kernel/perf.c | 1 + mm/page_alloc.c | 3 +++ 3 files changed, 5 insertions(+), 0 deletions(-) diff --git a/include/linux/perf.h b/include/linux/perf.h index bad338d..3be5c4a 100644 --- a/include/linux/perf.h +++ b/include/linux/perf.h @@ -15,6 +15,7 @@ enum pc_item { PC_UPDATE_PROCESS_TIMES, + PC_ALLOC_PAGES, NR_PC_ITEMS }; diff --git a/kernel/perf.c b/kernel/perf.c index 14cba9c..dd4e850 100644 --- a/kernel/perf.c +++ b/kernel/perf.c @@ -22,6 +22,7 @@ static int unsynced_get_cycles = 1; const char *var_id[NR_PC_ITEMS] = { "update_process_times", + "__alloc_pages" }; struct perf_counter { diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6d3550c..8f82827 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -1223,6 +1224,7 @@ struct page * fastcall __alloc_pages(gfp_t gfp_mask, unsigned int order, struct zonelist *zonelist) { + INIT_PC(pc); const gfp_t wait = gfp_mask & __GFP_WAIT; struct zone **z; struct page *page; @@ -1383,6 +1385,7 @@ nopage: show_mem(); } got_pg: + pc_bytes(&pc, PAGE_SIZE << order, PC_ALLOC_PAGES); return page; } -- 1.5.2.4