[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1287310576.1998.151.camel@laptop>
Date: Sun, 17 Oct 2010 12:16:16 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Ingo Molnar <mingo@...e.hu>
Cc: Frederic Weisbecker <fweisbec@...il.com>,
Jason Baron <jbaron@...hat.com>, linux-kernel@...r.kernel.org,
David Miller <davem@...emloft.net>,
Mike Galbraith <efault@....de>
Subject: Re: [RFC][PATCH 6/7] perf: use jump_label to optimize the
scheduler hooks
On Sun, 2010-10-17 at 11:52 +0200, Peter Zijlstra wrote:
> On Thu, 2010-10-14 at 22:34 +0200, Peter Zijlstra wrote:
> > +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);
> > +}
>
> OK, so I hate the JUMP_LABEL() interface for it means we have to keep
> writing these silly stubs.
The below seems to actually compile too, awesome! ;-)
---
Index: linux-2.6/include/linux/jump_label.h
===================================================================
--- linux-2.6.orig/include/linux/jump_label.h
+++ linux-2.6/include/linux/jump_label.h
@@ -61,4 +61,14 @@ static inline int jump_label_text_reserv
#endif
+#define COND_STMT(key, stmt) \
+do { \
+ __label__ jl_enabled; \
+ JUMP_LABEL(key, jl_enabled); \
+ if (0) { \
+jl_enabled: \
+ stmt; \
+ } \
+} while (0)
+
#endif
Index: linux-2.6/include/linux/perf_event.h
===================================================================
--- linux-2.6.orig/include/linux/perf_event.h
+++ linux-2.6/include/linux/perf_event.h
@@ -901,21 +901,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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists