From: Peter Zijlstra <peterz@infradead.org>
To: "Yan, Zheng" <zheng.z.yan@intel.com>
Cc: eranian@google.com, Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [BUG] uncore_pmu_event_init: using smp_processor_id() in preemptible core
Date: Tue, 17 Sep 2013 07:53:02 +0200 [thread overview]
Message-ID: <20130917055302.GB12926@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <5237E17A.80603@intel.com>
On Tue, Sep 17, 2013 at 12:58:34PM +0800, Yan, Zheng wrote:
> ---
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> index fd8011e..a12a22f 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> @@ -2713,7 +2713,10 @@ struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, int cp
>
> size = sizeof(*box) + type->num_shared_regs * sizeof(struct intel_uncore_extra_reg);
>
> - box = kzalloc_node(size, GFP_KERNEL, cpu_to_node(cpu));
> + if (cpu < 0)
> + box = kzalloc(size, GFP_KERNEL);
> + else
> + box = kzalloc_node(size, GFP_KERNEL, cpu_to_node(cpu));
> if (!box)
> return NULL;
I believe -1 is a valid node number for all allocators, in which case
they fall back to the current node.
>
> @@ -3031,7 +3034,7 @@ static int uncore_validate_group(struct intel_uncore_pmu *pmu,
> struct intel_uncore_box *fake_box;
> int ret = -EINVAL, n;
>
> - fake_box = uncore_alloc_box(pmu->type, smp_processor_id());
> + fake_box = uncore_alloc_box(pmu->type, -1);
> if (!fake_box)
> return -ENOMEM;
>
Yes, much better indeed.
prev parent reply other threads:[~2013-09-17 5:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 9:21 Peter Zijlstra
2013-09-17 4:58 ` Yan, Zheng
2013-09-17 5:53 ` Peter Zijlstra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130917055302.GB12926@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=zheng.z.yan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®