Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6928140imu; Thu, 31 Jan 2019 01:58:45 -0800 (PST) X-Google-Smtp-Source: ALg8bN6u9BBot+8beOaq8nRnTqvrDa70wCqe8dzF1bZz8lk3QCRf8z3P23D5l0v/kMkaXgqU/Qz1 X-Received: by 2002:a17:902:4503:: with SMTP id m3mr34569988pld.23.1548928725165; Thu, 31 Jan 2019 01:58:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548928725; cv=none; d=google.com; s=arc-20160816; b=Pdc2XKpBDlo1Vhqa37CWTWoqOPwhAsGdIxk5IMqz0sik6CNReksf0cguDQIJrFFyz0 dpGSWCu3tVtbNkeN8if++X5JzeByLM0JlbYuLQ3F0/mAD0Aute4Ve2HAvgdS7DEmkk/o 4dutYKSZVL/lf1eDLEGxmRk/xU6nmCHzIxiaeeFbZMbQsBT0oec84b1AhU4NvJuQyyRb n0MnNzmOibEMi4R2KYxEozTtFWgESy66Z+SHOcELc3IFld4s4v3A0inchDAhDh3MSWKP GyXersGCYYuONzcgGbuLc1tmA1FL1Q7LhREzExLVKZqHdZmiHOa5+fpB5GumO6OxCsZK lInA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KN65jVycwBIWs0n5vnAR5t/2bKTkjompeuCCWRbFckA=; b=lcqbBgPVg1d6zInO80m6rxD9Ujmia8XqXiFLxk9XO9oWp8BRBpFE6DT9S6oHxH5EjO OLWwo6Yu/RdRUnC4Ttm+KKz35zegv/MsmX6O+7xqO824deXg5Ej3oppJxTUdQkJJFLr6 051VR/GF6t/QhGMn3AKNwxmoeul37JEHFlMIlKWs3/Y5g8lkESvOjUiHrVcm6ksDBvZS 9hAqmIIW+vYFJ5r5ikgSrKr4SxQWs1FFbzGC+6Qzh0x2rgIDVOQaQVD+BY0/ytN8QhLI A7SOatCbkHPR7uBmISVrhgp01+Ohhizt7zfq36ysnV12HlIgI7GRBX7hvbAftdNk0OHL iLrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=IPmI1Jyz; 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 z3si4200828pln.430.2019.01.31.01.58.30; Thu, 31 Jan 2019 01:58:45 -0800 (PST) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=IPmI1Jyz; 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 S1731940AbfAaJ4w (ORCPT + 99 others); Thu, 31 Jan 2019 04:56:52 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:57948 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726316AbfAaJ4w (ORCPT ); Thu, 31 Jan 2019 04:56:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=KN65jVycwBIWs0n5vnAR5t/2bKTkjompeuCCWRbFckA=; b=IPmI1JyzbnKkgM7McXrYqBrrz FHSkE2SujZs2P1mG3fxLyarSMbT1ikrQ1/oSj9ptbDkfAkfPSeLH1ugHbHKjIH4vXBvVRfs5McXmh G0J2hadUwy6AsBgvrCjgEWA1mnir+bLWJ4niH5mXyhXeVm0fkKdbZsDkf1HwM+Kl8HhdyVGUg+6ZK lyZY7k5IZXEpCAWWFi816Cy8mvHWGeWPsf8EGpTk+nBOlJfoWbl8FSyC7ncDyw6igeaFRnp9KUqyR frxJb0AslimxFlTlEn0fRs7KaoxAhRYPG8mmlkKnHoKLguczt9jMJTIo8wTHQy2y4/hDhtoZkSSpI 3Zzyq3OUw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gp95M-0005cu-J7; Thu, 31 Jan 2019 09:56:40 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3164A20423039; Thu, 31 Jan 2019 10:56:38 +0100 (CET) Date: Thu, 31 Jan 2019 10:56:38 +0100 From: Peter Zijlstra To: Alex Kogan Cc: linux@armlinux.org.uk, mingo@redhat.com, will.deacon@arm.com, arnd@arndb.de, longman@redhat.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, steven.sistare@oracle.com, daniel.m.jordan@oracle.com, dave.dice@oracle.com, rahul.x.yadav@oracle.com Subject: Re: [PATCH 0/3] Add NUMA-awareness to qspinlock Message-ID: <20190131095638.GA31534@hirez.programming.kicks-ass.net> References: <20190131030136.56999-1-alex.kogan@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190131030136.56999-1-alex.kogan@oracle.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 30, 2019 at 10:01:32PM -0500, Alex Kogan wrote: > Lock throughput can be increased by handing a lock to a waiter on the > same NUMA socket as the lock holder, provided care is taken to avoid > starvation of waiters on other NUMA sockets. This patch introduces CNA > (compact NUMA-aware lock) as the slow path for qspinlock. Since you use NUMA, use the term node, not socket. The two are not strictly related. > CNA is a NUMA-aware version of the MCS spin-lock. Spinning threads are > organized in two queues, a main queue for threads running on the same > socket as the current lock holder, and a secondary queue for threads > running on other sockets. Threads record the ID of the socket on which > they are running in their queue nodes. At the unlock time, the lock > holder scans the main queue looking for a thread running on the same > socket. If found (call it thread T), all threads in the main queue > between the current lock holder and T are moved to the end of the > secondary queue, and the lock is passed to T. If such T is not found, the > lock is passed to the first node in the secondary queue. Finally, if the > secondary queue is empty, the lock is passed to the next thread in the > main queue. > > Full details are available at https://arxiv.org/abs/1810.05600. Full details really should also be in the Changelog. You can skip much of the academic bla-bla, but the Changelog should be self contained. > We have done some performance evaluation with the locktorture module > as well as with several benchmarks from the will-it-scale repo. > The following locktorture results are from an Oracle X5-4 server > (four Intel Xeon E7-8895 v3 @ 2.60GHz sockets with 18 hyperthreaded > cores each). Each number represents an average (over 5 runs) of the > total number of ops (x10^7) reported at the end of each run. The stock > kernel is v4.20.0-rc4+ compiled in the default configuration. > > #thr stock patched speedup (patched/stock) > 1 2.710 2.715 1.002 > 2 3.108 3.001 0.966 > 4 4.194 3.919 0.934 So low contention is actually worse. Funnily low contention is the majority of our locks and is _really_ important. > 8 5.309 6.894 1.299 > 16 6.722 9.094 1.353 > 32 7.314 9.885 1.352 > 36 7.562 9.855 1.303 > 72 6.696 10.358 1.547 > 108 6.364 10.181 1.600 > 142 6.179 10.178 1.647 > > When the kernel is compiled with lockstat enabled, CNA I'll ignore that, lockstat/lockdep enabled runs are not what one would call performance relevant.