[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5fda3599-1b51-5f58-fdcc-2afcf6d4968b@linux.intel.com>
Date: Wed, 24 Mar 2021 11:46:52 +0800
From: Like Xu <like.xu@...ux.intel.com>
To: Namhyung Kim <namhyung@...nel.org>,
Kan Liang <kan.liang@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>
Cc: 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>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>, x86@...nel.org,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 RESEND 3/5] perf/x86/lbr: Move cpuc->lbr_xsave
allocation out of sleeping region
Hi Namhyung,
On 2021/3/24 9:32, Namhyung Kim wrote:
> Hello,
>
> On Mon, Mar 22, 2021 at 3:14 PM Like Xu <like.xu@...ux.intel.com> wrote:
>> +void reserve_lbr_buffers(struct perf_event *event)
>> +{
>> + struct kmem_cache *kmem_cache = x86_get_pmu()->task_ctx_cache;
>> + struct cpu_hw_events *cpuc;
>> + int cpu;
>> +
>> + if (!static_cpu_has(X86_FEATURE_ARCH_LBR))
>> + return;
>> +
>> + for_each_possible_cpu(cpu) {
>> + cpuc = per_cpu_ptr(&cpu_hw_events, cpu);
>> + if (kmem_cache && !cpuc->lbr_xsave && !event->attr.precise_ip)
>> + cpuc->lbr_xsave = kmem_cache_alloc(kmem_cache, GFP_KERNEL);
>> + }
>> +}
>
> I think we should use kmem_cache_alloc_node().
"kmem_cache_alloc_node - Allocate an object on the specified node"
The reserve_lbr_buffers() is called in __x86_pmu_event_init().
When the LBR perf_event is scheduled to another node, it seems
that we will not call init() and allocate again.
Do you mean use kmem_cache_alloc_node() for each numa_nodes_parsed ?
>
> Thanks,
> Namhyung
>
Powered by blists - more mailing lists