From: Waiman Long <waiman.long@hpe.com>
To: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Cc: <linux-kernel@vger.kernel.org>, <mingo@redhat.com>,
<peterz@infradead.org>
Subject: Re: [PATCH] locking/qspinlock: Use this_cpu_ptr instead of this_cpu_dec
Date: Fri, 3 Jun 2016 17:20:10 -0400 [thread overview]
Message-ID: <5751F48A.6090508@hpe.com> (raw)
In-Reply-To: <1464947330-3568-1-git-send-email-xinhui.pan@linux.vnet.ibm.com>
On 06/03/2016 05:48 AM, Pan Xinhui wrote:
> queued_spin_lock_slowpath should not worry about interrupt change
> node->count by accident because ->count is inc and dec when we
> enter/leave queued_spin_lock_slowpath.
>
> So this_cpu_dec() does some no point things here, lets use this_cpu_ptr
> for a small optimization.
>
> Signed-off-by: Pan Xinhui<xinhui.pan@linux.vnet.ibm.com>
> ---
> kernel/locking/qspinlock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
> index 99f31e4..2b4daac 100644
> --- a/kernel/locking/qspinlock.c
> +++ b/kernel/locking/qspinlock.c
> @@ -492,7 +492,7 @@ release:
> /*
> * release the node
> */
> - this_cpu_dec(mcs_nodes[0].count);
> + this_cpu_ptr(&mcs_nodes[0])->count--;
> }
> EXPORT_SYMBOL(queued_spin_lock_slowpath);
>
Is this going to generate better code for PPC? For x86, I think it will
cause more instruction to be issued.
Cheers,
Longman
next prev parent reply other threads:[~2016-06-03 21:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-03 9:48 [PATCH] locking/qspinlock: Use this_cpu_ptr instead of this_cpu_dec Pan Xinhui
2016-06-03 11:37 ` Peter Zijlstra
2016-06-06 3:21 ` xinhui
2016-06-03 21:20 ` Waiman Long [this message]
2016-06-03 21:35 ` Peter Zijlstra
2016-06-06 4:48 ` xinhui
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=5751F48A.6090508@hpe.com \
--to=waiman.long@hpe.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=xinhui.pan@linux.vnet.ibm.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