From: Christoph Lameter <clameter@sgi.com>
To: linux-kernel@vger.kernel.org
Cc: Christoph Lameter <clameter@sgi.com>
Subject: [PATCH 5/7] Simple Performance Counters: __alloc_pages instrumentation
Date: Tue, 31 Jul 2007 16:25:10 -0700 [thread overview]
Message-ID: <11859243121375-git-send-email-clameter@sgi.com> (raw)
In-Reply-To: simple-perf-counters
Instrument __alloc_pages with a performance counter.
Allows the investigation of various allocation scenarios on page allocator
performance.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
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 2958c81..795b7ec 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 3da85b8..69d34b7 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -41,6 +41,7 @@
#include <linux/pfn.h>
#include <linux/backing-dev.h>
#include <linux/fault-inject.h>
+#include <linux/perf.h>
#include <asm/tlbflush.h>
#include <asm/div64.h>
@@ -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;
@@ -1387,6 +1389,7 @@ nopage:
show_mem();
}
got_pg:
+ pc_bytes(&pc, PAGE_SIZE << order, PC_ALLOC_PAGES);
return page;
}
--
1.5.2.4
reply other threads:[~2007-07-31 23:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11859243121375-git-send-email-clameter@sgi.com \
--to=clameter@sgi.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.