]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> |
2 | Subject: LTTng instrumentation - page_alloc | |
3 | ||
4 | Original patch header: | |
5 | LTTng instrumentation - page_alloc | |
6 | ||
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 | |
9 | separate patch. | |
10 | ||
11 | Those tracepoints are used by LTTng. | |
12 | ||
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. | |
18 | ||
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> | |
29 | ||
30 | Acked-by: Jan Blunck <jblunck@suse.de> | |
31 | --- | |
32 | --- | |
33 | include/trace/page_alloc.h | 16 ++++++++++++++++ | |
34 | mm/page_alloc.c | 7 +++++++ | |
35 | 2 files changed, 23 insertions(+) | |
36 | ||
37 | --- /dev/null | |
38 | +++ b/include/trace/page_alloc.h | |
39 | @@ -0,0 +1,16 @@ | |
40 | +#ifndef _TRACE_PAGE_ALLOC_H | |
41 | +#define _TRACE_PAGE_ALLOC_H | |
42 | + | |
43 | +#include <linux/tracepoint.h> | |
44 | + | |
45 | +/* | |
46 | + * mm_page_alloc : page can be NULL. | |
47 | + */ | |
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)); | |
54 | + | |
55 | +#endif | |
56 | --- a/mm/page_alloc.c | |
57 | +++ b/mm/page_alloc.c | |
58 | @@ -51,6 +51,8 @@ | |
59 | #include <asm/div64.h> | |
60 | #include "internal.h" | |
61 | ||
62 | +#include <trace/page_alloc.h> | |
63 | + | |
64 | /* | |
65 | * Array of node states. | |
66 | */ | |
67 | @@ -528,6 +530,8 @@ static void __free_pages_ok(struct page | |
68 | int i; | |
69 | int reserved = 0; | |
70 | ||
71 | + trace_page_free(page, order); | |
72 | + | |
73 | for (i = 0 ; i < (1 << order) ; ++i) | |
74 | reserved += free_pages_check(page + i); | |
75 | if (reserved) | |
76 | @@ -988,6 +992,8 @@ static void free_hot_cold_page(struct pa | |
77 | struct per_cpu_pages *pcp; | |
78 | unsigned long flags; | |
79 | ||
80 | + trace_page_free(page, 0); | |
81 | + | |
82 | if (PageAnon(page)) | |
83 | page->mapping = NULL; | |
84 | if (free_pages_check(page)) | |
85 | @@ -1658,6 +1664,7 @@ nopage: | |
86 | show_mem(); | |
87 | } | |
88 | got_pg: | |
89 | + trace_page_alloc(page, order); | |
90 | return page; | |
91 | } | |
92 | EXPORT_SYMBOL(__alloc_pages_internal); |