[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3da6d2d62663a0689957d1ed731f0ccca4ed89d7.1425310176.git.tom.zanussi@linux.intel.com>
Date: Mon, 2 Mar 2015 10:01:01 -0600
From: Tom Zanussi <tom.zanussi@...ux.intel.com>
To: rostedt@...dmis.org
Cc: masami.hiramatsu.pt@...achi.com, namhyung@...nel.org,
andi@...stfloor.org, ast@...mgrid.com,
linux-kernel@...r.kernel.org,
Tom Zanussi <tom.zanussi@...ux.intel.com>
Subject: [PATCH 08/15] tracing: Make kmem memory allocation tracepoints conditional
Making the memory allocation tracepoints conditional allows those
events to be traced using the functions containing them e.g. the
kmalloc_trace() handler can itself use kmalloc() in the trace path,
which otherwise wouldn't be possible.
The TP_CONDITION simply tests gfp_flags for the newly introduced
___GFP_NOTRACE and if true, the tracepoint simply returns without
tracing.
This allows _notrace versions of the memory allocation functions to be
defined, which do the same thing as the normal versions but in
addition set the ___GFP_NOTRACE flag, and thus avoid the (possibly
indirect) recursive calls to themselves.
Signed-off-by: Tom Zanussi <tom.zanussi@...ux.intel.com>
---
include/trace/events/kmem.h | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index aece134..6d34eed 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -42,20 +42,24 @@ DECLARE_EVENT_CLASS(kmem_alloc,
show_gfp_flags(__entry->gfp_flags))
);
-DEFINE_EVENT(kmem_alloc, kmalloc,
+DEFINE_EVENT_CONDITION(kmem_alloc, kmalloc,
TP_PROTO(unsigned long call_site, const void *ptr,
size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags),
+
+ TP_CONDITION(!(gfp_flags & ___GFP_NOTRACE))
);
-DEFINE_EVENT(kmem_alloc, kmem_cache_alloc,
+DEFINE_EVENT_CONDITION(kmem_alloc, kmem_cache_alloc,
TP_PROTO(unsigned long call_site, const void *ptr,
size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags),
+
+ TP_CONDITION(!(gfp_flags & ___GFP_NOTRACE))
);
DECLARE_EVENT_CLASS(kmem_alloc_node,
@@ -96,22 +100,26 @@ DECLARE_EVENT_CLASS(kmem_alloc_node,
__entry->node)
);
-DEFINE_EVENT(kmem_alloc_node, kmalloc_node,
+DEFINE_EVENT_CONDITION(kmem_alloc_node, kmalloc_node,
TP_PROTO(unsigned long call_site, const void *ptr,
size_t bytes_req, size_t bytes_alloc,
gfp_t gfp_flags, int node),
- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
+
+ TP_CONDITION(!(gfp_flags & ___GFP_NOTRACE))
);
-DEFINE_EVENT(kmem_alloc_node, kmem_cache_alloc_node,
+DEFINE_EVENT_CONDITION(kmem_alloc_node, kmem_cache_alloc_node,
TP_PROTO(unsigned long call_site, const void *ptr,
size_t bytes_req, size_t bytes_alloc,
gfp_t gfp_flags, int node),
- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
+
+ TP_CONDITION(!(gfp_flags & ___GFP_NOTRACE))
);
DECLARE_EVENT_CLASS(kmem_free,
@@ -191,13 +199,15 @@ TRACE_EVENT(mm_page_free_batched,
__entry->cold)
);
-TRACE_EVENT(mm_page_alloc,
+TRACE_EVENT_CONDITION(mm_page_alloc,
TP_PROTO(struct page *page, unsigned int order,
gfp_t gfp_flags, int migratetype),
TP_ARGS(page, order, gfp_flags, migratetype),
+ TP_CONDITION(!(gfp_flags & ___GFP_NOTRACE)),
+
TP_STRUCT__entry(
__field( struct page *, page )
__field( unsigned int, order )
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists