Prev: [PATCH 01/13] jump label v9: notifier atomic call chain notrace
Next: [PATCH 00/13] jump label v9
From: Jason Baron on 9 Jun 2010 17:40 Make use of the jump label infrastructure for tracepoints. Signed-off-by: Jason Baron <jbaron(a)redhat.com> --- include/linux/tracepoint.h | 8 ++++++-- kernel/tracepoint.c | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 9a59d1f..883df16 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -16,6 +16,7 @@ #include <linux/types.h> #include <linux/rcupdate.h> +#include <linux/jump_label.h> struct module; struct tracepoint; @@ -144,7 +145,9 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, extern struct tracepoint __tracepoint_##name; \ static inline void trace_##name(proto) \ { \ - if (unlikely(__tracepoint_##name.state)) \ + JUMP_LABEL(&__tracepoint_##name, do_trace, __tracepoint_##name.state);\ + return; \ +do_trace: \ __DO_TRACE(&__tracepoint_##name, \ TP_PROTO(data_proto), \ TP_ARGS(data_args)); \ @@ -171,7 +174,8 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, __attribute__((section("__tracepoints_strings"))) = #name; \ struct tracepoint __tracepoint_##name \ __attribute__((section("__tracepoints"), aligned(32))) = \ - { __tpstrtab_##name, 0, reg, unreg, NULL } + { __tpstrtab_##name, 0, reg, unreg, NULL }; \ + DEFINE_JUMP_LABEL(name); #define DEFINE_TRACE(name) \ DEFINE_TRACE_FN(name, NULL, NULL); diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index c77f3ec..b16d873 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c @@ -25,6 +25,7 @@ #include <linux/err.h> #include <linux/slab.h> #include <linux/sched.h> +#include <linux/jump_label.h> extern struct tracepoint __start___tracepoints[]; extern struct tracepoint __stop___tracepoints[]; @@ -263,6 +264,10 @@ static void set_tracepoint(struct tracepoint_entry **entry, * is used. */ rcu_assign_pointer(elem->funcs, (*entry)->funcs); + if (!elem->state && active) + enable_jump_label(elem->name); + if (elem->state && !active) + disable_jump_label(elem->name); elem->state = active; } @@ -277,6 +282,9 @@ static void disable_tracepoint(struct tracepoint *elem) if (elem->unregfunc && elem->state) elem->unregfunc(); + if (elem->state) + disable_jump_label(elem->name); + elem->state = 0; rcu_assign_pointer(elem->funcs, NULL); } -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: [PATCH 01/13] jump label v9: notifier atomic call chain notrace Next: [PATCH 00/13] jump label v9 |