1 From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
2 Subject: LTTng instrumentation - page_alloc
5 LTTng instrumentation - page_alloc
7 Paging activity instrumentation. Instruments page allocation/free to keep track
8 of page allocation. This does not cover hugetlb activity, which is covered by a
11 Those tracepoints are used by LTTng.
13 About the performance impact of tracepoints (which is comparable to markers),
14 even without immediate values optimizations, tests done by Hideo Aoki on ia64
15 show no regression. His test case was using hackbench on a kernel where
16 scheduler instrumentation (about 5 events in code scheduler code) was added.
17 See the "Tracepoints" patch header for performance result detail.
19 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
20 CC: Martin Bligh <mbligh@google.com>
21 CC: Masami Hiramatsu <mhiramat@redhat.com>
22 CC: 'Peter Zijlstra' <peterz@infradead.org>
23 CC: "Frank Ch. Eigler" <fche@redhat.com>
24 CC: 'Ingo Molnar' <mingo@elte.hu>
25 CC: 'Hideo AOKI' <haoki@redhat.com>
26 CC: Takashi Nishiie <t-nishiie@np.css.fujitsu.com>
27 CC: 'Steven Rostedt' <rostedt@goodmis.org>
28 CC: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
30 Acked-by: Jan Blunck <jblunck@suse.de>
33 include/trace/page_alloc.h | 16 ++++++++++++++++
34 mm/page_alloc.c | 7 +++++++
35 2 files changed, 23 insertions(+)
38 +++ b/include/trace/page_alloc.h
40 +#ifndef _TRACE_PAGE_ALLOC_H
41 +#define _TRACE_PAGE_ALLOC_H
43 +#include <linux/tracepoint.h>
46 + * mm_page_alloc : page can be NULL.
48 +DEFINE_TRACE(page_alloc,
49 + TPPROTO(struct page *page, unsigned int order),
50 + TPARGS(page, order));
51 +DEFINE_TRACE(page_free,
52 + TPPROTO(struct page *page, unsigned int order),
53 + TPARGS(page, order));
59 #include <asm/div64.h>
62 +#include <trace/page_alloc.h>
65 * Array of node states.
67 @@ -528,6 +530,8 @@ static void __free_pages_ok(struct page
71 + trace_page_free(page, order);
73 for (i = 0 ; i < (1 << order) ; ++i)
74 reserved += free_pages_check(page + i);
76 @@ -991,6 +995,8 @@ static void free_hot_cold_page(struct pa
77 struct per_cpu_pages *pcp;
80 + trace_page_free(page, 0);
84 if (free_pages_check(page))
85 @@ -1663,6 +1669,7 @@ nopage:
89 + trace_page_alloc(page, order);
92 EXPORT_SYMBOL(__alloc_pages_internal);