From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88EE7C33CA9 for ; Mon, 13 Jan 2020 16:48:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5D1772084D for ; Mon, 13 Jan 2020 16:48:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oZ9k1PFg"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="pDmGLcYw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D1772084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I+dAxH5n397ZC6jhL2YmyUjHuNQqBgJHpRQmfeAXf/o=; b=oZ9k1PFg0qbKuv ZjzCsWSPKrEJzXUK/fRG/a15yNbSV35+wjpZf46V0nknBkn1/kNaEg0B2rJn142A+shY2Ubrx+jum Sm0dLb5yjY0yH1BJXz3Dubcb/taTZEgRCDpHQwCBsdOqnbcA0+9mXuGkzVtvpg0xfZncJrWStPBrn f/92bA5qFH/fcNcrPwLi84oKx6xMI5vBxOGZlA3uZUK5B0MNxGM4xTcbU0ljb600wV/p9fQUH/pyl zKcR7lP4kvEeRZ1twYtYlrvs6iw92bkRczZzg7IsrssEcP7vZty9yCrFw7vzInbRSHPt7TOwmAf3q E3AdWoOwxg2hceosFpIQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ir2tJ-0002Ft-SR; Mon, 13 Jan 2020 16:48:37 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ir2tG-0002FS-M6 for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2020 16:48:35 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C7D8720678; Mon, 13 Jan 2020 16:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578934114; bh=I3pCwFrEYhOyoSeIyVb525rkGpVzdanvyIQ5HUTW1xM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pDmGLcYwmjusySW/+wTtAxLrekFoWM+e9Zb+fN9bdnwubkxlnXOVx0aeta5n1vet5 4s6N6zNutce+C3GH6JFKtPCcWUl+GF4H7R4IxFvt0Ju0VIx2ZkmSPZ1fn9qiTwD95N JfZe3ca0EOLiF8HxM0fvH/zYdkXrTnoi7xOeTCt0= Date: Mon, 13 Jan 2020 16:48:29 +0000 From: Will Deacon To: Waiman Long Subject: Re: [PATCH v3] locking/osq: Use optimized spinning loop for arm64 Message-ID: <20200113164828.GF4458@willie-the-truck> References: <20200113150735.21956-1-longman@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200113150735.21956-1-longman@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200113_084834_743087_135A3AE6 X-CRM114-Status: GOOD ( 16.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Zijlstra , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, yezengruan , Ingo Molnar , maz@kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jan 13, 2020 at 10:07:35AM -0500, Waiman Long wrote: > Arm64 has a more optimized spinning loop (atomic_cond_read_acquire) > using wfe for spinlock that can boost performance of sibling threads > by putting the current cpu to a wait state that is broken only when > the monitored variable changes or an external event happens. > > OSQ has a more complicated spinning loop. Besides the lock value, it > also checks for need_resched() and vcpu_is_preempted(). The check for > need_resched() is not a problem as it is only set by the tick interrupt > handler. That will be detected by the spinning cpu right after iret. > > The vcpu_is_preempted() check, however, is a problem as changes to the > preempt state of of previous node will not affect the wait state. For > ARM64, vcpu_is_preempted is not currently defined and so is a no-op. > Will has indicated that he is planning to para-virtualize wfe instead > of defining vcpu_is_preempted for PV support. So just add a comment in > arch/arm64/include/asm/spinlock.h to indicate that vcpu_is_preempted() > should not be defined as suggested. > > On a 2-socket 56-core 224-thread ARM64 system, a kernel mutex locking > microbenchmark was run for 10s with and without the patch. The > performance numbers before patch were: > > Running locktest with mutex [runtime = 10s, load = 1] > Threads = 224, Min/Mean/Max = 316/123,143/2,121,269 > Threads = 224, Total Rate = 2,757 kop/s; Percpu Rate = 12 kop/s > > After patch, the numbers were: > > Running locktest with mutex [runtime = 10s, load = 1] > Threads = 224, Min/Mean/Max = 334/147,836/1,304,787 > Threads = 224, Total Rate = 3,311 kop/s; Percpu Rate = 15 kop/s > > So there was about 20% performance improvement. > > Signed-off-by: Waiman Long > --- > arch/arm64/include/asm/spinlock.h | 9 +++++++++ > kernel/locking/osq_lock.c | 17 ++++------------- > 2 files changed, 13 insertions(+), 13 deletions(-) Acked-by: Will Deacon Thanks, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel