diff options
| author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-10-17 06:15:00 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-10-18 13:59:01 -0400 |
| commit | ebf31f502492527e2b6b5e5cf85a4ebc7fc8a52e (patch) | |
| tree | 71d65e73fedaee937d90b52d6efa1d9cbeaeff42 | |
| parent | 7e54a5a0b655734326dc78c2b5efc1eb35497bb6 (diff) | |
jump_label: Add COND_STMT(), reducer wrappery
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>
| -rw-r--r-- | include/linux/jump_label.h | 10 | ||||
| -rw-r--r-- | include/linux/perf_event.h | 12 |
2 files changed, 12 insertions, 10 deletions
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index 81be4962b7a1..b67cb180e6e9 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h | |||
| @@ -61,4 +61,14 @@ static inline int jump_label_text_reserved(void *start, void *end) | |||
| 61 | 61 | ||
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | #define COND_STMT(key, stmt) \ | ||
| 65 | do { \ | ||
| 66 | __label__ jl_enabled; \ | ||
| 67 | JUMP_LABEL(key, jl_enabled); \ | ||
| 68 | if (0) { \ | ||
| 69 | jl_enabled: \ | ||
| 70 | stmt; \ | ||
| 71 | } \ | ||
| 72 | } while (0) | ||
| 73 | |||
| 64 | #endif | 74 | #endif |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 3b80cbf509ef..057bf22a8323 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -903,21 +903,13 @@ extern atomic_t perf_task_events; | |||
| 903 | 903 | ||
| 904 | static inline void perf_event_task_sched_in(struct task_struct *task) | 904 | static inline void perf_event_task_sched_in(struct task_struct *task) |
| 905 | { | 905 | { |
| 906 | JUMP_LABEL(&perf_task_events, have_events); | 906 | COND_STMT(&perf_task_events, __perf_event_task_sched_in(task)); |
| 907 | return; | ||
| 908 | |||
| 909 | have_events: | ||
| 910 | __perf_event_task_sched_in(task); | ||
| 911 | } | 907 | } |
| 912 | 908 | ||
| 913 | static inline | 909 | static inline |
| 914 | void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next) | 910 | void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next) |
| 915 | { | 911 | { |
| 916 | JUMP_LABEL(&perf_task_events, have_events); | 912 | COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next)); |
| 917 | return; | ||
| 918 | |||
| 919 | have_events: | ||
| 920 | __perf_event_task_sched_out(task, next); | ||
| 921 | } | 913 | } |
| 922 | 914 | ||
| 923 | extern int perf_event_init_task(struct task_struct *child); | 915 | extern int perf_event_init_task(struct task_struct *child); |
