From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752080AbcFCJtd (ORCPT ); Fri, 3 Jun 2016 05:49:33 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:57960 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338AbcFCJtb (ORCPT ); Fri, 3 Jun 2016 05:49:31 -0400 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: xinhui.pan@linux.vnet.ibm.com X-IBM-RcptTo: waiman.long@hpe.com;peterz@infradead.org;mingo@redhat.com;linux-kernel@vger.kernel.org From: Pan Xinhui To: linux-kernel@vger.kernel.org Cc: mingo@redhat.com, peterz@infradead.org, waiman.long@hpe.com, Pan Xinhui Subject: [PATCH] locking/qspinlock: Use this_cpu_ptr instead of this_cpu_dec Date: Fri, 3 Jun 2016 17:48:50 +0800 Message-Id: <1464947330-3568-1-git-send-email-xinhui.pan@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16060309-0009-0000-0000-00003801D9A6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); -- 1.9.1