Skip to contentSkip to conversation

perf: Per cpu-context rotation timer

tip:perf/core tip-bot for Peter Zijlstra 1 participant 1 message Sep 9, 2010 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  b5ab4cd563e7ab49b27957704112a8ecade54e1f
Gitweb:     http://git.kernel.org/tip/b5ab4cd563e7ab49b27957704112a8ecade54e1f
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Mon, 6 Sep 2010 16:32:21 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 9 Sep 2010 20:46:32 +0200

perf: Per cpu-context rotation timer

Give each cpu-context its own timer so that it is a self contained entity, this eases the way for per-pmu-per-cpu contexts as well as provides the basic infrastructure to allow different rotation times per pmu.

Things to look at:
- folding the tick and these TICK_NSEC timers
- separate task context rotation

Cc paulus <[email protected]>
Cc stephane eranian <[email protected]>
Cc Robert Richter <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Lin Ming <[email protected]>
Cc Yanmin <[email protected]>

LKML-Reference: <new-submission>

---
 include/linux/perf_event.h |    5 +--
 kernel/perf_event.c        |   80 ++++++++++++++++++++++++++++++++++---------
 kernel/sched.c             |    2 -
 3 files changed, 65 insertions(+), 22 deletions(-)
include/linux/perf_event.h +2 -3
index 4ab4f0c..fa04537 100644
@@ -861,6 +861,8 @@ struct perf_cpu_context {
 	struct perf_event_context	*task_ctx;
 	int				active_oncpu;
 	int				exclusive;
+	u64				timer_interval;
+	struct hrtimer			timer;
 };
 
 struct perf_output_handle {
@@ -881,7 +883,6 @@ extern void perf_pmu_unregister(struct pmu *pmu);
 
 extern void perf_event_task_sched_in(struct task_struct *task);
 extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
-extern void perf_event_task_tick(struct task_struct *task);
 extern int perf_event_init_task(struct task_struct *child);
 extern void perf_event_exit_task(struct task_struct *child);
 extern void perf_event_free_task(struct task_struct *task);
@@ -1067,8 +1068,6 @@ perf_event_task_sched_in(struct task_struct *task)			{ }
 static inline void
 perf_event_task_sched_out(struct task_struct *task,
 			    struct task_struct *next)			{ }
-static inline void
-perf_event_task_tick(struct task_struct *task)				{ }
 static inline int perf_event_init_task(struct task_struct *child)	{ return 0; }
 static inline void perf_event_exit_task(struct task_struct *child)	{ }
 static inline void perf_event_free_task(struct task_struct *task)	{ }
kernel/perf_event.c +63 -17

151 lines not on this page · raw message

kernel/sched.c +0 -2
index 09b574e..66a02ba 100644
@@ -3578,8 +3578,6 @@ void scheduler_tick(void)
 	curr->sched_class->task_tick(rq, curr, 0);
 	raw_spin_unlock(&rq->lock);
 
-	perf_event_task_tick(curr);
-
 #ifdef CONFIG_SMP
 	rq->idle_at_tick = idle_cpu(cpu);
 	trigger_load_balance(rq, cpu);