From patchwork Wed Apr 11 18:01:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 133155 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp894966ljb; Wed, 11 Apr 2018 11:01:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/ZFXR+G/OMCQhndPKNVf8chnQLcii+hLkj53IsHtfCfIX3d/fjdcPn5llH2TQGaA4v+ndd X-Received: by 2002:a17:902:14cb:: with SMTP id y11-v6mr6247029plg.23.1523469676843; Wed, 11 Apr 2018 11:01:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523469676; cv=none; d=google.com; s=arc-20160816; b=vSg7l0TDVLmoBCi+kWKQjtAlaHduzkJEp9qzXaFv7jgeQebT8JntJ6rZDVrq9XJAdq /mzWPNfQr7rNgTOp4o+ohwTMq74c2ZZLqTG10ibsPb2sfSXKzBoP607aKXRxG0p64x3X AYw+he4lwW1YiO6YBbbu/6jOiX0DuqbHkqgISKw0MV503JE8bMJk9o6nbsrN7PPm1RDP oA2D3e7B7556uDANXv4C7xMRTphAERArfJgAqPj2DOQATITQAH+Cr3rExxb7KyqZGP0o QYUnVg4RW6yVSQ7603A1Ixb1SYPkm9/IgwL9Q4JA95Hnzsk1NBt2kDz/hMeR9FrlBozn M1VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=UpprWzWKCZ0TgY+oDKG2nWb+NaAp1aw4+EHl+/QuLWw=; b=fzc8YDGq/lP2ugt4EOY8qL8EJ07/fFeUjstawiOyvfN2WJojk2Z9LH70B+4WWJhOfA Dty+YGpby5yks1C6WTh5CSH/2bkFWFNIivXHr9aYenSnt5cdooUu5VO+YnDlA97KOuVW a8ccU5yEJBBoWzYY0KeMJTt0ojG2NoqGrgQBsWU6Y0VM1helWpxS+k8mz2hvB7CRitFR XYWxlMp80MomM/Wb3vWKfdzGrTduMInGgLn7a6r07swB8p/q6F5U8zWh4Z9uOTESMmfD GkcOLx6UL1nwTFvt6lBBh69/6BmdfjyF2Eqs/x/MWG0UmWok/iV4GvhdjHgJ8kzP7H8X adqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si1543676plg.715.2018.04.11.11.01.16; Wed, 11 Apr 2018 11:01:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753047AbeDKSBK (ORCPT + 29 others); Wed, 11 Apr 2018 14:01:10 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52054 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752584AbeDKSBG (ORCPT ); Wed, 11 Apr 2018 14:01:06 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3FCA115BE; Wed, 11 Apr 2018 11:01:06 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 104753F77D; Wed, 11 Apr 2018 11:01:06 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 767411AE5591; Wed, 11 Apr 2018 19:01:21 +0100 (BST) From: Will Deacon To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, peterz@infradead.org, mingo@kernel.org, boqun.feng@gmail.com, paulmck@linux.vnet.ibm.com, longman@redhat.com, Will Deacon Subject: [PATCH v2 03/13] locking/qspinlock/x86: Increase _Q_PENDING_LOOPS upper bound Date: Wed, 11 Apr 2018 19:01:10 +0100 Message-Id: <1523469680-17699-4-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1523469680-17699-1-git-send-email-will.deacon@arm.com> References: <1523469680-17699-1-git-send-email-will.deacon@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On x86, atomic_cond_read_relaxed will busy-wait with a cpu_relax() loop, so it is desirable to increase the number of times we spin on the qspinlock lockword when it is found to be transitioning from pending to locked. According to Waiman Long: | Ideally, the spinning times should be at least a few times the typical | cacheline load time from memory which I think can be down to 100ns or | so for each cacheline load with the newest systems or up to several | hundreds ns for older systems. which in his benchmarking corresponded to 512 iterations. Cc: Peter Zijlstra Cc: Ingo Molnar Suggested-by: Waiman Long Signed-off-by: Will Deacon --- arch/x86/include/asm/qspinlock.h | 2 ++ 1 file changed, 2 insertions(+) -- 2.1.4 diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h index 5e16b5d40d32..2f09915f4aa4 100644 --- a/arch/x86/include/asm/qspinlock.h +++ b/arch/x86/include/asm/qspinlock.h @@ -7,6 +7,8 @@ #include #include +#define _Q_PENDING_LOOPS (1 << 9) + #define queued_spin_unlock queued_spin_unlock /** * queued_spin_unlock - release a queued spinlock