lkml.org 
[lkml]   [2014]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V5 08/16] perf, x86: track number of events that use LBR callstack
On Wed, Sep 10, 2014 at 10:09:05AM -0400, kan.liang@intel.com wrote:
> @@ -204,9 +204,15 @@ void intel_pmu_lbr_sched_task(struct perf_event_context *ctx, bool sched_in)
> }
> }
>
> +static inline bool branch_user_callstack(unsigned br_sel)
> +{
> + return (br_sel & X86_BR_USER) && (br_sel & X86_BR_CALL_STACK);
> +}
> +
> void intel_pmu_lbr_enable(struct perf_event *event)
> {
> struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
> + struct x86_perf_task_context *task_ctx;
>
> if (!x86_pmu.lbr_nr)
> return;
> @@ -220,6 +226,10 @@ void intel_pmu_lbr_enable(struct perf_event *event)
> }
> cpuc->br_sel = event->hw.branch_reg.reg;
>
> + task_ctx = event->ctx ? event->ctx->task_ctx_data : NULL;
> + if (task_ctx && branch_user_callstack(cpuc->br_sel))
> + task_ctx->lbr_callstack_users++;
> +

Does it make sense to flip those conditions to avoid a potentially
useless dereference?


\
 
 \ /
  Last update: 2014-09-24 15:21    [W:0.357 / U:0.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site