[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKPBJoK1b/2PIQfk@hirez.programming.kicks-ass.net>
Date: Tue, 18 May 2021 15:29:10 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Like Xu <like.xu@...ux.intel.com>
Cc: Kan Liang <kan.liang@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
linux-kernel@...r.kernel.org, Borislav Petkov <bp@...en8.de>,
seanjc@...gle.com, x86@...nel.org
Subject: Re: [PATCH v2 2/2] perf/x86/lbr: Move cpuc->lbr_xsave allocation out
of sleeping region
On Tue, May 18, 2021 at 08:34:33PM +0800, Like Xu wrote:
> > > + if (!static_cpu_has(X86_FEATURE_ARCH_LBR))
> > > + return;
> > > +
> > > + for_each_possible_cpu(cpu) {
> > > + cpuc = per_cpu_ptr(&cpu_hw_events, cpu);
> > > + kmem_cache = x86_get_pmu(cpu)->task_ctx_cache;
> > > + if (kmem_cache && !cpuc->lbr_xsave && !event->attr.precise_ip)
> > > + cpuc->lbr_xsave =
> > > + kmem_cache_alloc_node(kmem_cache, GFP_KERNEL,
> > > + cpu_to_node(cpu));
> >
> > (coding style fail)
> >
> > But then I looked at this function, and srlsy that !precise_ip is the
> > only thing you need @event for? Why do we care?
>
> Kan once commented, we only need to alloc the buffer for the non-PEBS
> event. It seems the check "(cpuc->lbr_users != cpuc->lbr_pebs_users)"
> is implicitly removed.
>
> I think we still need to check !precision_ip, right ?
It's just a memory allocation; who cares if we allocate but not use it
ever?
Powered by blists - more mailing lists