[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160603213549.GB3710@twins.programming.kicks-ass.net>
Date: Fri, 3 Jun 2016 23:35:49 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Waiman Long <waiman.long@....com>
Cc: Pan Xinhui <xinhui.pan@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org, mingo@...hat.com
Subject: Re: [PATCH] locking/qspinlock: Use this_cpu_ptr instead of
this_cpu_dec
On Fri, Jun 03, 2016 at 05:20:10PM -0400, Waiman Long wrote:
> 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@...ux.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.
It does; I think he wants __this_cpu_dec() instead, but the Changelog
needs improvement to explain why that is ok.
Powered by blists - more mailing lists