]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.trace/lttng-instrumentation-swap.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.trace / lttng-instrumentation-swap.patch
1 From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
2 Subject: LTTng instrumentation - swap
3
4 Original patch header:
5 LTTng instrumentation - swap
6
7 Instrumentation of waits caused by swap activity. Also instrumentation
8 swapon/swapoff events to keep track of active swap partitions.
9
10 Those tracepoints are used by LTTng.
11
12 About the performance impact of tracepoints (which is comparable to markers),
13 even without immediate values optimizations, tests done by Hideo Aoki on ia64
14 show no regression. His test case was using hackbench on a kernel where
15 scheduler instrumentation (about 5 events in code scheduler code) was added.
16 See the "Tracepoints" patch header for performance result detail.
17
18 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
19 CC: linux-mm@kvack.org
20 CC: Dave Hansen <haveblue@us.ibm.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/swap.h | 20 ++++++++++++++++++++
34 mm/memory.c | 3 +++
35 mm/page_io.c | 2 ++
36 mm/swapfile.c | 3 +++
37 4 files changed, 28 insertions(+)
38
39 --- /dev/null
40 +++ b/include/trace/swap.h
41 @@ -0,0 +1,20 @@
42 +#ifndef _TRACE_SWAP_H
43 +#define _TRACE_SWAP_H
44 +
45 +#include <linux/swap.h>
46 +#include <linux/tracepoint.h>
47 +
48 +DEFINE_TRACE(swap_in,
49 + TPPROTO(struct page *page, swp_entry_t entry),
50 + TPARGS(page, entry));
51 +DEFINE_TRACE(swap_out,
52 + TPPROTO(struct page *page),
53 + TPARGS(page));
54 +DEFINE_TRACE(swap_file_open,
55 + TPPROTO(struct file *file, char *filename),
56 + TPARGS(file, filename));
57 +DEFINE_TRACE(swap_file_close,
58 + TPPROTO(struct file *file),
59 + TPARGS(file));
60 +
61 +#endif
62 --- a/mm/memory.c
63 +++ b/mm/memory.c
64 @@ -64,6 +64,8 @@
65
66 #include "internal.h"
67
68 +#include <trace/swap.h>
69 +
70 #ifndef CONFIG_NEED_MULTIPLE_NODES
71 /* use the per-pgdat data instead for discontigmem - mbligh */
72 unsigned long max_mapnr;
73 @@ -2441,6 +2443,7 @@ static int do_swap_page(struct mm_struct
74 /* Had to read the page from swap area: Major fault */
75 ret = VM_FAULT_MAJOR;
76 count_vm_event(PGMAJFAULT);
77 + trace_swap_in(page, entry);
78 }
79
80 if (mem_cgroup_charge(page, mm, GFP_KERNEL)) {
81 --- a/mm/page_io.c
82 +++ b/mm/page_io.c
83 @@ -17,6 +17,7 @@
84 #include <linux/bio.h>
85 #include <linux/swapops.h>
86 #include <linux/writeback.h>
87 +#include <trace/swap.h>
88 #include <asm/pgtable.h>
89
90 static struct bio *get_swap_bio(gfp_t gfp_flags, pgoff_t index,
91 @@ -114,6 +115,7 @@ int swap_writepage(struct page *page, st
92 rw |= (1 << BIO_RW_SYNC);
93 count_vm_event(PSWPOUT);
94 set_page_writeback(page);
95 + trace_swap_out(page);
96 unlock_page(page);
97 submit_bio(rw, bio);
98 out:
99 --- a/mm/swapfile.c
100 +++ b/mm/swapfile.c
101 @@ -36,6 +36,7 @@
102 #include <asm/pgtable.h>
103 #include <asm/tlbflush.h>
104 #include <linux/swapops.h>
105 +#include <trace/swap.h>
106
107 static DEFINE_SPINLOCK(swap_lock);
108 static unsigned int nr_swapfiles;
109 @@ -1325,6 +1326,7 @@ SYSCALL_DEFINE1(swapoff, const char __us
110 swap_map = p->swap_map;
111 p->swap_map = NULL;
112 p->flags = 0;
113 + trace_swap_file_close(swap_file);
114 spin_unlock(&swap_lock);
115 mutex_unlock(&swapon_mutex);
116 vfree(swap_map);
117 @@ -1704,6 +1706,7 @@ SYSCALL_DEFINE2(swapon, const char __use
118 } else {
119 swap_info[prev].next = p - swap_info;
120 }
121 + trace_swap_file_open(swap_file, name);
122 spin_unlock(&swap_lock);
123 mutex_unlock(&swapon_mutex);
124 error = 0;