On Wed, Sep 10, 2014 at 10:08:59AM -0400, [email protected] wrote:
> From: Kan Liang <[email protected]>
> 
> The callback is invoked when process is scheduled in or out.
> It provides mechanism for later patches to save/store the LBR
> stack. For the schedule in case, the callback is invoked at
> the same place that flush branch stack callback is invoked.
> So it also can replace the flush branch stack callback. To
> avoid unnecessary overhead, the callback is enabled only when
> there are events use the LBR stack.
> 
> Signed-off-by: Yan, Zheng <[email protected]>

Same broken attribution and SoB chain.


> +void perf_sched_cb_disable(struct pmu *pmu)
> +{
> +     this_cpu_dec(perf_sched_cb_usages);
> +}
> +
> +void perf_sched_cb_enable(struct pmu *pmu)
> +{
> +     this_cpu_inc(perf_sched_cb_usages);
> +}

lkml.kernel.org/r/[email protected]

> +/*
> + * This function provides the context switch callback to the lower code
> + * layer. It is invoked ONLY when the context switch callback is enabled.
> + */
> +static void perf_pmu_sched_task(struct task_struct *prev,
> +                             struct task_struct *next,
> +                             bool sched_in)
> +{
> +     struct perf_cpu_context *cpuctx;
> +     struct pmu *pmu;
> +     unsigned long flags;
> +
> +     if (prev == next)
> +             return;
> +
> +     local_irq_save(flags);
> +
> +     rcu_read_lock();
> +
> +     list_for_each_entry_rcu(pmu, &pmus, entry) {
> +             if (pmu->sched_task) {
> +                     cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
> +
> +                     perf_ctx_lock(cpuctx, cpuctx->task_ctx);
> +
> +                     perf_pmu_disable(pmu);
> +
> +                     pmu->sched_task(cpuctx->task_ctx, sched_in);
> +
> +                     perf_pmu_enable(pmu);
> +
> +                     perf_ctx_unlock(cpuctx, cpuctx->task_ctx);
> +                     /* only CPU PMU has context switch callback */
> +                     break;
> +             }
> +     }
> +
> +     rcu_read_unlock();
> +
> +     local_irq_restore(flags);
> +}

lkml.kernel.org/r/[email protected]

Maybe you should have read back the previous postings before taking over
this series :-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to