From 54e6171895006a006a71fd70183fef1f0375882b Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 16 Mar 2011 19:04:35 -0400 Subject: lttng-instrumentation/lttng-instrumentation-memory LTTng instrumentation - memory page faults Instrument the page fault entry and exit. Useful to detect delays caused by page faults and bad memory usage patterns. 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 CC: Andi Kleen CC: linux-mm@kvack.org CC: Dave Hansen CC: Masami Hiramatsu CC: 'Peter Zijlstra' CC: "Frank Ch. Eigler" CC: 'Ingo Molnar' CC: 'Hideo AOKI' CC: Takashi Nishiie CC: 'Steven Rostedt' CC: Eduard - Gabriel Munteanu --- mm/memory.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mm') diff --git a/mm/memory.c b/mm/memory.c index 17751b386f7..dc955dad52a 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -69,6 +70,8 @@ #include "internal.h" DEFINE_TRACE(swap_in); +DEFINE_TRACE(page_fault_get_user_entry); +DEFINE_TRACE(page_fault_get_user_exit); #ifndef CONFIG_NEED_MULTIPLE_NODES /* use the per-pgdat data instead for discontigmem - mbligh */ @@ -1519,6 +1522,8 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, int ret; unsigned int fault_flags = 0; + trace_page_fault_get_user_entry(mm, + vma, start, foll_flags & FOLL_WRITE); if (foll_flags & FOLL_WRITE) fault_flags |= FAULT_FLAG_WRITE; if (nonblocking) @@ -1526,6 +1531,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, ret = handle_mm_fault(mm, vma, start, fault_flags); + trace_page_fault_get_user_exit(ret); if (ret & VM_FAULT_ERROR) { if (ret & VM_FAULT_OOM) -- cgit v1.2.3