From patchwork Thu Apr 26 10:34:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 134469 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2079083lji; Thu, 26 Apr 2018 03:34:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+q87GhkOfAS4x+RbDXuiAxVJVk/SN6LWia/xhWe8Yx/Yjuf+UbLHsubcJQqm3b+RE5Mo0A X-Received: by 10.167.133.12 with SMTP id v12mr20842909pfn.90.1524738869426; Thu, 26 Apr 2018 03:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524738869; cv=none; d=google.com; s=arc-20160816; b=oXErxNh+7odT+vrLQ8S1gWzc1cJUWAZDBC6/bw7THq3WZF0me9gaclIYG4xjAhkUAl Suzygb9C//2J9NENGw1StVYIZMtHUchR5yaIkB44+vsRbFrrFLq4upfpfwlyFf6Q/R40 9UoD2yndpJRnlGgQdcODfn/7H5rDHhTOtHOHgHtKrwlkdBEnTgCiWn+i4N6YLe0+QvJo 1tRRqgQSM9VcjlkI6HEnQM2CjhKkysc8H4xIvPyjUYMfxn/zv/nx+hOsfD1f+Ba7SrJ4 TTOGFW5UfpARbRpbRHhorYFKcR6EpBsLhaE46XQ7Ta/KEtvGMA35UOU6elP24bflk+EM Wurw== 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=N6DvhPmlmCuRy8VmGQHWq4TvcqHsUTaCg374LC/OgXE=; b=AE7iv3lYfVi5TRHdQhtWwsG7wkrTZ6kC2TdxhzeqkNr66qiQon4Nh/XCG8zJsoIDF7 dD8kP2JkgGU9dh1pt8lHh7Qnj4k7vJfJMkDWnSabO8WdSOD798489D7CtWZ/ia1D7WHm cFR97g6cbCXW4JNlT1ztHQDi1iDV5Sb0E/9NBcpaXDCZ0VdmYLC+CuJk+bb2yNU5V2dq LhYpTWQVvEXUrIYHj/OBEHT7qcQdrkOoNxWPqoVE6U19PVdNfxWc+pChh0AFKwwI5MRh DBpuVtyB047p/e/+IZp/GzenlnlKw4OFaVXwCIzXiXgvlUi2aNGBR/NuRXDQpHXbx+ER HHQw== 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 e15si14928706pga.573.2018.04.26.03.34.29; Thu, 26 Apr 2018 03:34:29 -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 S1755583AbeDZKeZ (ORCPT + 29 others); Thu, 26 Apr 2018 06:34:25 -0400 Received: from foss.arm.com ([217.140.101.70]:51038 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754862AbeDZKeJ (ORCPT ); Thu, 26 Apr 2018 06:34:09 -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 95BEC169F; Thu, 26 Apr 2018 03:34:09 -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 6640D3F77A; Thu, 26 Apr 2018 03:34:09 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 16A001AE50EB; Thu, 26 Apr 2018 11:34:29 +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@arm.com Subject: [PATCH v3 04/14] locking/qspinlock/x86: Increase _Q_PENDING_LOOPS upper bound Date: Thu, 26 Apr 2018 11:34:18 +0100 Message-Id: <1524738868-31318-5-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1524738868-31318-1-git-send-email-will.deacon@arm.com> References: <1524738868-31318-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 90b0b0ed8161..da1370ad206d 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