perf_counter: Fix dynamic irq_period logging
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Sat, 23 May 2009 16:28:55 +0000 (18:28 +0200)
committerIngo Molnar <mingo@elte.hu>
Sat, 23 May 2009 17:37:44 +0000 (19:37 +0200)
We call perf_adjust_freq() from perf_counter_task_tick() which
is is called under the rq->lock causing lock recursion.
However, it's no longer required to be called under the
rq->lock, so remove it from under it.

Also, fix up some related comments.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <20090523163012.476197912@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/perf_counter.h
kernel/perf_counter.c
kernel/sched.c

index 2eedae8498d3a9594120946ea2a19f27760b3edc..23ddd29730f81ad0d936136e74804a6ec669ca8e 100644 (file)
@@ -260,6 +260,7 @@ enum perf_event_type {
        /*
         * struct {
         *      struct perf_event_header        header;
+        *      u64                             time;
         *      u64                             irq_period;
         * };
         */
index c10055416dea56aff4fa85027851c56b7f087f03..2f410ea2cb3997e80d9853d3e69169147fc38398 100644 (file)
@@ -2559,7 +2559,8 @@ void perf_counter_munmap(unsigned long addr, unsigned long len,
 }
 
 /*
- *
+ * Log irq_period changes so that analyzing tools can re-normalize the
+ * event flow.
  */
 
 static void perf_log_period(struct perf_counter *counter, u64 period)
index 4c0d58bce6b28febe75049a7476cb8796b2a6b44..ad079f07c9c8c35529a2e3a63fb694169b4047a7 100644 (file)
@@ -4875,9 +4875,10 @@ void scheduler_tick(void)
        update_rq_clock(rq);
        update_cpu_load(rq);
        curr->sched_class->task_tick(rq, curr, 0);
-       perf_counter_task_tick(curr, cpu);
        spin_unlock(&rq->lock);
 
+       perf_counter_task_tick(curr, cpu);
+
 #ifdef CONFIG_SMP
        rq->idle_at_tick = idle_cpu(cpu);
        trigger_load_balance(rq, cpu);