lkml.org 
[lkml]   [2008]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 12/15] LTTng instrumentation - hugetlb
Instrumentation of hugetlb activity (alloc/free/reserve).

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: William Lee Irwin III <wli@holomorphy.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: '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>
---
mm/hugetlb-trace.h | 19 +++++++++++++++++++
mm/hugetlb.c | 8 +++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
Index: linux-2.6-lttng/mm/hugetlb.c
===================================================================
--- linux-2.6-lttng.orig/mm/hugetlb.c 2008-07-07 16:31:44.000000000 -0400
+++ linux-2.6-lttng/mm/hugetlb.c 2008-07-08 10:51:17.000000000 -0400
@@ -14,6 +14,7 @@
#include <linux/mempolicy.h>
#include <linux/cpuset.h>
#include <linux/mutex.h>
+#include "hugetlb-trace.h"

#include <asm/page.h>
#include <asm/pgtable.h>
@@ -141,6 +142,7 @@ static void free_huge_page(struct page *
int nid = page_to_nid(page);
struct address_space *mapping;

+ trace_hugetlb_page_free(page);
mapping = (struct address_space *) page_private(page);
set_page_private(page, 0);
BUG_ON(page_count(page));
@@ -509,6 +511,7 @@ static struct page *alloc_huge_page(stru
if (!IS_ERR(page)) {
set_page_refcounted(page);
set_page_private(page, (unsigned long) mapping);
+ trace_hugetlb_page_alloc(page);
}
return page;
}
@@ -1306,13 +1309,16 @@ int hugetlb_reserve_pages(struct inode *
return ret;
}
region_add(&inode->i_mapping->private_list, from, to);
+ trace_hugetlb_pages_reserve(inode, from, to);
return 0;
}

void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed)
{
- long chg = region_truncate(&inode->i_mapping->private_list, offset);
+ long chg;

+ trace_hugetlb_pages_unreserve(inode, offset, freed);
+ chg = region_truncate(&inode->i_mapping->private_list, offset);
spin_lock(&inode->i_lock);
inode->i_blocks -= BLOCKS_PER_HUGEPAGE * freed;
spin_unlock(&inode->i_lock);
Index: linux-2.6-lttng/mm/hugetlb-trace.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6-lttng/mm/hugetlb-trace.h 2008-07-08 10:45:15.000000000 -0400
@@ -0,0 +1,19 @@
+#ifndef _HUGETLB_TRACE_H
+#define _HUGETLB_TRACE_H
+
+#include <linux/tracepoint.h>
+
+DEFINE_TRACE(hugetlb_page_alloc,
+ TPPROTO(struct page *page),
+ TPARGS(page));
+DEFINE_TRACE(hugetlb_page_free,
+ TPPROTO(struct page *page),
+ TPARGS(page));
+DEFINE_TRACE(hugetlb_pages_reserve,
+ TPPROTO(struct inode *inode, long from, long to),
+ TPARGS(inode, from, to));
+DEFINE_TRACE(hugetlb_pages_unreserve,
+ TPPROTO(struct inode *inode, long offset, long freed),
+ TPARGS(inode, offset, freed));
+
+#endif
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68


\
 
 \ /
  Last update: 2008-07-09 17:09    [from the cache]
©2003-2011 Jasper Spaans