diff options
| author | Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 2008-05-12 21:21:09 +0200 | 
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-23 22:25:27 +0200 | 
| commit | dc102a8fae2d0d6bf5223fc549247f2e23959ae6 (patch) | |
| tree | ccb36b8bfd106ef70d2a9a83629ca502a497d9f3 /kernel/trace/trace_selftest.c | |
| parent | 3eefae994d9224fb7771a3ddb683868363c23510 (diff) | |
| download | olio-linux-3.10-dc102a8fae2d0d6bf5223fc549247f2e23959ae6.tar.xz olio-linux-3.10-dc102a8fae2d0d6bf5223fc549247f2e23959ae6.zip  | |
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 'kernel/trace/trace_selftest.c')
0 files changed, 0 insertions, 0 deletions