From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: peterz@infradead.org, acme@ghostprotocols.net, mingo@kernel.org,
tglx@linutronix.de, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH 2/2] perf, cpu hotplug: Use cached value of smp_processor_id()
Date: Tue, 16 Oct 2012 09:32:11 -0700 [thread overview]
Message-ID: <20121016163211.GB2385@linux.vnet.ibm.com> (raw)
In-Reply-To: <20121016075817.3572.76733.stgit@srivatsabhat.in.ibm.com>
On Tue, Oct 16, 2012 at 01:28:17PM +0530, Srivatsa S. Bhat wrote:
> The perf_cpu_notifier() macro invokes smp_processor_id() multiple
> times. Optimize it by using a local variable.
>
> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
>
> include/linux/perf_event.h | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 0647805..6bfb2faa 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -803,15 +803,16 @@ static inline void perf_event_task_tick(void) { }
> do { \
> static struct notifier_block fn##_nb __cpuinitdata = \
> { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
> + unsigned long cpu = smp_processor_id(); \
> unsigned long flags; \
> fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \
> - (void *)(unsigned long)smp_processor_id()); \
> + (void *)(unsigned long)cpu); \
> local_irq_save(flags); \
> fn(&fn##_nb, (unsigned long)CPU_STARTING, \
> - (void *)(unsigned long)smp_processor_id()); \
> + (void *)(unsigned long)cpu); \
> local_irq_restore(flags); \
> fn(&fn##_nb, (unsigned long)CPU_ONLINE, \
> - (void *)(unsigned long)smp_processor_id()); \
> + (void *)(unsigned long)cpu); \
> register_cpu_notifier(&fn##_nb); \
> } while (0)
>
>
next prev parent reply other threads:[~2012-10-16 17:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 7:58 [RESEND PATCH 1/2] perf, cpu hotplug: Run CPU_STARTING notifiers with irqs disabled Srivatsa S. Bhat
2012-10-16 7:58 ` [RESEND PATCH 2/2] perf, cpu hotplug: Use cached value of smp_processor_id() Srivatsa S. Bhat
2012-10-16 16:32 ` Paul E. McKenney [this message]
2012-10-24 9:40 ` [tip:perf/core] " tip-bot for Srivatsa S. Bhat
2012-10-16 16:31 ` [RESEND PATCH 1/2] perf, cpu hotplug: Run CPU_STARTING notifiers with irqs disabled Paul E. McKenney
2012-10-16 16:37 ` Srivatsa S. Bhat
2012-10-16 18:34 ` Paul E. McKenney
2012-10-17 4:48 ` Srivatsa S. Bhat
2012-10-24 9:39 ` [tip:perf/core] " tip-bot for Srivatsa S. Bhat
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=20121016163211.GB2385@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=acme@ghostprotocols.net \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.