summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>2011-03-16 19:04:34 -0400
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>2011-03-16 19:04:34 -0400
commit85f84b8888712d234a3746fdf74a9ff36c58a8aa (patch)
tree0f18458cb08580a5805fbb6e2753318a25013002 /mm
parent710fff2054cc7838d7e98714e4a78610a52547a2 (diff)
lttng-instrumentation/lttng-instrumentation-swap
LTTng instrumentation - swap Instrumentation of waits caused by swap activity. Also instrumentation swapon/swapoff events to keep track of active swap partitions. 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@polymtl.ca> CC: linux-mm@kvack.org CC: Dave Hansen <haveblue@us.ibm.com> CC: Masami Hiramatsu <mhiramat@redhat.com> CC: 'Peter Zijlstra' <peterz@infradead.org> CC: "Frank Ch. Eigler" <fche@redhat.com> CC: 'Ingo Molnar' <mingo@elte.hu> CC: Frederic Weisbecker <fweisbec@gmail.com> CC: 'Hideo AOKI' <haoki@redhat.com> CC: Takashi Nishiie <t-nishiie@np.css.fujitsu.com> CC: 'Steven Rostedt' <rostedt@goodmis.org> CC: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Diffstat (limited to 'mm')
-rw-r--r--mm/memory.c4
-rw-r--r--mm/page_io.c4
-rw-r--r--mm/swapfile.c6
3 files changed, 14 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 5823698c2b7..17751b386f7 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -57,6 +57,7 @@
#include <linux/swapops.h>
#include <linux/elf.h>
#include <linux/gfp.h>
+#include <trace/swap.h>
#include <asm/io.h>
#include <asm/pgalloc.h>
@@ -67,6 +68,8 @@
#include "internal.h"
+DEFINE_TRACE(swap_in);
+
#ifndef CONFIG_NEED_MULTIPLE_NODES
/* use the per-pgdat data instead for discontigmem - mbligh */
unsigned long max_mapnr;
@@ -2747,6 +2750,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
/* Had to read the page from swap area: Major fault */
ret = VM_FAULT_MAJOR;
count_vm_event(PGMAJFAULT);
+ trace_swap_in(page, entry);
} else if (PageHWPoison(page)) {
/*
* hwpoisoned dirty swapcache pages are kept for killing
diff --git a/mm/page_io.c b/mm/page_io.c
index 2dee975bf46..d262ffb0c2d 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -18,8 +18,11 @@
#include <linux/bio.h>
#include <linux/swapops.h>
#include <linux/writeback.h>
+#include <trace/swap.h>
#include <asm/pgtable.h>
+DEFINE_TRACE(swap_out);
+
static struct bio *get_swap_bio(gfp_t gfp_flags,
struct page *page, bio_end_io_t end_io)
{
@@ -109,6 +112,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
rw |= REQ_SYNC | REQ_UNPLUG;
count_vm_event(PSWPOUT);
set_page_writeback(page);
+ trace_swap_out(page);
unlock_page(page);
submit_bio(rw, bio);
out:
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 5a001ff3055..f92237cd55c 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -31,12 +31,16 @@
#include <linux/syscalls.h>
#include <linux/memcontrol.h>
#include <linux/poll.h>
+#include <trace/swap.h>
#include <asm/pgtable.h>
#include <asm/tlbflush.h>
#include <linux/swapops.h>
#include <linux/page_cgroup.h>
+DEFINE_TRACE(swap_file_open);
+DEFINE_TRACE(swap_file_close);
+
static bool swap_count_continued(struct swap_info_struct *, pgoff_t,
unsigned char);
static void free_swap_count_continuations(struct swap_info_struct *);
@@ -1669,6 +1673,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
swap_map = p->swap_map;
p->swap_map = NULL;
p->flags = 0;
+ trace_swap_file_close(swap_file);
spin_unlock(&swap_lock);
mutex_unlock(&swapon_mutex);
vfree(swap_map);
@@ -2129,6 +2134,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
swap_list.head = swap_list.next = type;
else
swap_info[prev]->next = type;
+ trace_swap_file_open(swap_file, name);
spin_unlock(&swap_lock);
mutex_unlock(&swapon_mutex);
atomic_inc(&proc_poll_event);