aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>2008-05-12 15:21:09 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-23 16:25:27 -0400
commitdc102a8fae2d0d6bf5223fc549247f2e23959ae6 (patch)
treeccb36b8bfd106ef70d2a9a83629ca502a497d9f3 /include
parent3eefae994d9224fb7771a3ddb683868363c23510 (diff)
Markers - remove extra format argument
Denys Vlasenko <vda.linux@googlemail.com> : > Not in this patch, but I noticed: > > #define __trace_mark(name, call_private, format, args...) \ > do { \ > static const char __mstrtab_##name[] \ > __attribute__((section("__markers_strings"))) \ > = #name "\0" format; \ > static struct marker __mark_##name \ > __attribute__((section("__markers"), aligned(8))) = \ > { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)], \ > 0, 0, marker_probe_cb, \ > { __mark_empty_function, NULL}, NULL }; \ > __mark_check_format(format, ## args); \ > if (unlikely(__mark_##name.state)) { \ > (*__mark_##name.call) \ > (&__mark_##name, call_private, \ > format, ## args); \ > } \ > } while (0) > > In this call: > > (*__mark_##name.call) \ > (&__mark_##name, call_private, \ > format, ## args); \ > > you make gcc allocate duplicate format string. You can use > &__mstrtab_##name[sizeof(#name)] instead since it holds the same string, > or drop ", format," above and "const char *fmt" from here: > > void (*call)(const struct marker *mdata, /* Probe wrapper */ > void *call_private, const char *fmt, ...); > > since mdata->format is the same and all callees which need it can take it there. Very good point. I actually thought about dropping it, since it would remove an unnecessary argument from the stack. And actually, since I now have the marker_probe_cb sitting between the marker site and the callbacks, there is no API change required. Thanks :) Mathieu Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> CC: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/marker.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/include/linux/marker.h b/include/linux/marker.h
index 430f6adf9762..338533abb47b 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -44,8 +44,8 @@ struct marker {
44 */ 44 */
45 char state; /* Marker state. */ 45 char state; /* Marker state. */
46 char ptype; /* probe type : 0 : single, 1 : multi */ 46 char ptype; /* probe type : 0 : single, 1 : multi */
47 void (*call)(const struct marker *mdata, /* Probe wrapper */ 47 /* Probe wrapper */
48 void *call_private, const char *fmt, ...); 48 void (*call)(const struct marker *mdata, void *call_private, ...);
49 struct marker_probe_closure single; 49 struct marker_probe_closure single;
50 struct marker_probe_closure *multi; 50 struct marker_probe_closure *multi;
51} __attribute__((aligned(8))); 51} __attribute__((aligned(8)));
@@ -72,8 +72,7 @@ struct marker {
72 __mark_check_format(format, ## args); \ 72 __mark_check_format(format, ## args); \
73 if (unlikely(__mark_##name.state)) { \ 73 if (unlikely(__mark_##name.state)) { \
74 (*__mark_##name.call) \ 74 (*__mark_##name.call) \
75 (&__mark_##name, call_private, \ 75 (&__mark_##name, call_private, ## args);\
76 format, ## args); \
77 } \ 76 } \
78 } while (0) 77 } while (0)
79 78
@@ -117,9 +116,9 @@ static inline void __printf(1, 2) ___mark_check_format(const char *fmt, ...)
117extern marker_probe_func __mark_empty_function; 116extern marker_probe_func __mark_empty_function;
118 117
119extern void marker_probe_cb(const struct marker *mdata, 118extern void marker_probe_cb(const struct marker *mdata,
120 void *call_private, const char *fmt, ...); 119 void *call_private, ...);
121extern void marker_probe_cb_noarg(const struct marker *mdata, 120extern void marker_probe_cb_noarg(const struct marker *mdata,
122 void *call_private, const char *fmt, ...); 121 void *call_private, ...);
123 122
124/* 123/*
125 * Connect a probe to a marker. 124 * Connect a probe to a marker.