Messages in this thread | | | Date | Wed, 12 Sep 2012 17:49:41 +0200 | Subject | Re: [PATCH v2 2/3] perf: use hrtimer for event multiplexing | From | Stephane Eranian <> |
| |
On Wed, Sep 12, 2012 at 5:37 PM, Stephane Eranian <eranian@google.com> wrote: > On Wed, Sep 12, 2012 at 4:43 PM, Stephane Eranian <eranian@google.com> wrote: >> On Wed, Sep 12, 2012 at 4:22 PM, Peter Zijlstra <peterz@infradead.org> wrote: >>> On Wed, 2012-09-12 at 16:13 +0200, Stephane Eranian wrote: >>>> +static DEFINE_PER_CPU(struct list_head, rotation_list); >>> >>> Why do you keep the rotation list? The only use seems to be: >>> >>> >>>> +void perf_cpu_hrtimer_cancel(int cpu) >>>> +{ >>>> + struct list_head *head = &__get_cpu_var(rotation_list); >>>> + struct perf_cpu_context *cpuctx, *tmp; >>>> + unsigned long flags; >>>> + >>>> + if (WARN_ON(cpu != smp_processor_id())) >>>> + return; >>>> + >>>> + local_irq_save(flags); >>>> + >>>> + list_for_each_entry_safe(cpuctx, tmp, head, rotation_list) { >>>> + if (cpuctx->hrtimer_active) { >>>> + hrtimer_cancel(&cpuctx->hrtimer); >>>> + cpuctx->hrtimer_active = 0; >>>> + } >>>> + } >>>> + >>>> + local_irq_restore(flags); >>>> +} >>> >>> Which is weird, why not use the existing for-each-pmu loop in >>> perf_event_exit_cpu_context() ? Or something similar to iterate all >>> extant PMUs and thus their cpuctxs? >>> >> True. That would probably work too. >> > Note however that the rotation_list is still used in perf_event_task_tick() > to iterate over the ctx which needs unthrottling. We would have to switch > that loop over to a for-each-pmu() which would necessary incur more > iterations as it would include all the SW PMUs.
That reminds me that dropping sw context from rotation_list causes an issue in perf_event_task_tick() because that means the sw PMU are not considered anymore for interrupt unthrottling but they should. So I think switching to for-each-pmu() in perf_event_task_tick() will solve that problem too.
| |