jump_label: Add COND_STMT(), reducer wrappery
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Sun, 17 Oct 2010 10:15:00 +0000 (12:15 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 18 Oct 2010 17:59:01 +0000 (19:59 +0200)
The use of the JUMP_LABEL() construct ends up creating endless silly
wrappers, create a higher level construct to reduce this clutter.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/jump_label.h
include/linux/perf_event.h

index 81be4962b7a1a6537096b1bdac38bf16682ffb37..b67cb180e6e943ffef4f70577c0a8f503b496cee 100644 (file)
@@ -61,4 +61,14 @@ static inline int jump_label_text_reserved(void *start, void *end)
 
 #endif
 
+#define COND_STMT(key, stmt)                                   \
+do {                                                           \
+       __label__ jl_enabled;                                   \
+       JUMP_LABEL(key, jl_enabled);                            \
+       if (0) {                                                \
+jl_enabled:                                                    \
+               stmt;                                           \
+       }                                                       \
+} while (0)
+
 #endif
index 3b80cbf509ef04fa06052b3226befcf54557b971..057bf22a8323463a6bd9279d6928d3fea7ed8eb8 100644 (file)
@@ -903,21 +903,13 @@ extern atomic_t perf_task_events;
 
 static inline void perf_event_task_sched_in(struct task_struct *task)
 {
-       JUMP_LABEL(&perf_task_events, have_events);
-       return;
-
-have_events:
-       __perf_event_task_sched_in(task);
+       COND_STMT(&perf_task_events, __perf_event_task_sched_in(task));
 }
 
 static inline
 void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next)
 {
-       JUMP_LABEL(&perf_task_events, have_events);
-       return;
-
-have_events:
-       __perf_event_task_sched_out(task, next);
+       COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next));
 }
 
 extern int perf_event_init_task(struct task_struct *child);