[patch 12/17] LTTng instrumentation - page
From: Mathieu Desnoyers
Date: Tue Jul 15 2008 - 18:31:46 EST
Paging activity instrumentation. Instruments page allocation/free to keep track
of page allocation. This does not cover hugetlb activity, which is covered by a
separate patch.
Those tracepoints are used by LTTng.
About the performance impact of tracepoints (which is comparable to markers),
even without immediate values optimizations, tests done by Hideo Aoki on ia64
show no regression. His test case was using hackbench on a kernel where
scheduler instrumentation (about 5 events in code scheduler code) was added.
See the "Tracepoints" patch header for performance result detail.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxx>
CC: Martin Bligh <mbligh@xxxxxxxxxx>
CC: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
CC: 'Peter Zijlstra' <peterz@xxxxxxxxxxxxx>
CC: "Frank Ch. Eigler" <fche@xxxxxxxxxx>
CC: 'Ingo Molnar' <mingo@xxxxxxx>
CC: 'Hideo AOKI' <haoki@xxxxxxxxxx>
CC: Takashi Nishiie <t-nishiie@xxxxxxxxxxxxxxxxxx>
CC: 'Steven Rostedt' <rostedt@xxxxxxxxxxx>
CC: Eduard - Gabriel Munteanu <eduard.munteanu@xxxxxxxxxxx>
---
include/trace/page.h | 16 ++++++++++++++++
mm/page_alloc.c | 6 ++++++
2 files changed, 22 insertions(+)
Index: linux-2.6-lttng/mm/page_alloc.c
===================================================================
--- linux-2.6-lttng.orig/mm/page_alloc.c 2008-07-15 13:54:46.000000000 -0400
+++ linux-2.6-lttng/mm/page_alloc.c 2008-07-15 14:04:38.000000000 -0400
@@ -46,6 +46,7 @@
#include <linux/page-isolation.h>
#include <linux/memcontrol.h>
#include <linux/debugobjects.h>
+#include <trace/page.h>
#include <asm/tlbflush.h>
#include <asm/div64.h>
@@ -510,6 +511,8 @@ static void __free_pages_ok(struct page
int i;
int reserved = 0;
+ trace_page_free(page, order);
+
for (i = 0 ; i < (1 << order) ; ++i)
reserved += free_pages_check(page + i);
if (reserved)
@@ -966,6 +969,8 @@ static void free_hot_cold_page(struct pa
struct per_cpu_pages *pcp;
unsigned long flags;
+ trace_page_free(page, 0);
+
if (PageAnon(page))
page->mapping = NULL;
if (free_pages_check(page))
@@ -1630,6 +1635,7 @@ nopage:
show_mem();
}
got_pg:
+ trace_page_alloc(page, order);
return page;
}
Index: linux-2.6-lttng/include/trace/page.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6-lttng/include/trace/page.h 2008-07-15 14:04:38.000000000 -0400
@@ -0,0 +1,16 @@
+#ifndef _TRACE_PAGE_H
+#define _TRACE_PAGE_H
+
+#include <linux/tracepoint.h>
+
+/*
+ * mm_page_alloc : page can be NULL.
+ */
+DEFINE_TRACE(page_alloc,
+ TPPROTO(struct page *page, unsigned int order),
+ TPARGS(page, order));
+DEFINE_TRACE(page_free,
+ TPPROTO(struct page *page, unsigned int order),
+ TPARGS(page, order));
+
+#endif
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/