Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4602610ybl; Wed, 22 Jan 2020 00:59:49 -0800 (PST) X-Google-Smtp-Source: APXvYqz4U5hklO7CRSYkuLw1q1pAUZQFsNwFMzgel8c05mc+W/82FqyUCbQw4eqGcAxmGPrQfIUJ X-Received: by 2002:aca:af8b:: with SMTP id y133mr6166331oie.73.1579683589415; Wed, 22 Jan 2020 00:59:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579683589; cv=none; d=google.com; s=arc-20160816; b=ww8iQuMUO51NNqxnIxHFF+B/cN89gDrAvUhsoboaXUq2ouRgZNEyh4pi8q9WeIx2yk wAufyuFtKMT/4SHLZmWJefXAVh8lab9G3GVN0z7N5YU5zmdp60M4DhaUItc+PyrYGtmT I54kh+TSTQxlJ7jzZ4iRSPTWkSuVEky1xQxFdibI3k00ydeFS0017eGdk9CSu969QNex 0k7vXNdCuQo8QOsGRCm1BlL+JgVgqczMLNl5fcEU5SppQ+cWYRfPkrAqvsNP640lWfGz Vuu2oPFXkEez+B1yYWRBmzB1nJnd8jrSCeUs57FynmSp+f9+8HR98lmvMWbQlaX3iQ40 ekBw== 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=7svPehaLaqky9llQfR00v+4R1iUxkwoJQpdGOaEOt44=; b=L3f/YMWT96gsc4FaKXG/3sQUvRjNWPmLSVAufx8ezmCxZi3o0FC8vk7t3neyzG4Nzb I9i9sEMFMNEuVmCevKYgX9hDPjYGaYMwduZ0mSQqwC5WgiJsYJzpY0XUYsLcnYhFOCD7 A6EOZgUgy5gKSETjTiDrP24Z9KtPcrx7ie6aLAI13rvQEvZd5ZJgKOui2meqbrIIU1/z rH9qMj0tTNhJjZ7k4cbC7ByLucSOIlqWxut8Y4WgfT2ADhqvQqndrQiad80MAB+Jd3/Z DOyUS1Wi3T5G02dX9S5jejrZFhWWtqBTMjNKt9RQPKfyonLaIIldlkg2SxAIrxaAxOvZ JBpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oKakU8GB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13si18873468oiy.28.2020.01.22.00.59.37; Wed, 22 Jan 2020 00:59:49 -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=pass header.i=@kernel.org header.s=default header.b=oKakU8GB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729083AbgAVI6Z (ORCPT + 99 others); Wed, 22 Jan 2020 03:58:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:51684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725862AbgAVI6Z (ORCPT ); Wed, 22 Jan 2020 03:58:25 -0500 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 8A0542253D; Wed, 22 Jan 2020 08:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579683503; bh=wYfcRaLJtEbKOeSJp7ItR4eKrQug0zW9UUl6qHernP4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oKakU8GByrZCSyz/lp4L7EWEwgj4wGOJ0MiaU0u/6ItkamUgJaDGJIa3LpGcFOQAz 7iV8+yNHR0KUR9v7iY5R0Fyt3hKLJBcbbz6cuqFNugxPBUcgcyEJHPzizZSpcwa19R R7FB7VvMAUYdGy6k/fp4nO2uE8tC5IPlsDo/+ER4= Date: Wed, 22 Jan 2020 08:58:17 +0000 From: Will Deacon To: Peter Zijlstra Cc: Alex Kogan , linux-arch@vger.kernel.org, guohanjun@huawei.com, arnd@arndb.de, dave.dice@oracle.com, jglauber@marvell.com, x86@kernel.org, will.deacon@arm.com, linux@armlinux.org.uk, steven.sistare@oracle.com, linux-kernel@vger.kernel.org, rahul.x.yadav@oracle.com, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, longman@redhat.com, tglx@linutronix.de, daniel.m.jordan@oracle.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v7 3/5] locking/qspinlock: Introduce CNA into the slow path of qspinlock Message-ID: <20200122085816.GB15537@willie-the-truck> References: <20191125210709.10293-1-alex.kogan@oracle.com> <20191125210709.10293-4-alex.kogan@oracle.com> <20200121202919.GM11457@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200121202919.GM11457@worktop.programming.kicks-ass.net> 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 Tue, Jan 21, 2020 at 09:29:19PM +0100, Peter Zijlstra wrote: > > various notes and changes in the below. > > --- > > Index: linux-2.6/kernel/locking/qspinlock.c > =================================================================== > --- linux-2.6.orig/kernel/locking/qspinlock.c > +++ linux-2.6/kernel/locking/qspinlock.c > @@ -598,10 +598,10 @@ EXPORT_SYMBOL(queued_spin_lock_slowpath) > #define _GEN_CNA_LOCK_SLOWPATH > > #undef pv_wait_head_or_lock > -#define pv_wait_head_or_lock cna_pre_scan > +#define pv_wait_head_or_lock cna_wait_head_or_lock > > #undef try_clear_tail > -#define try_clear_tail cna_try_change_tail > +#define try_clear_tail cna_try_clear_tail > > #undef mcs_pass_lock > #define mcs_pass_lock cna_pass_lock > Index: linux-2.6/kernel/locking/qspinlock_cna.h > =================================================================== > --- linux-2.6.orig/kernel/locking/qspinlock_cna.h > +++ linux-2.6/kernel/locking/qspinlock_cna.h > @@ -8,37 +8,37 @@ > /* > * Implement a NUMA-aware version of MCS (aka CNA, or compact NUMA-aware lock). > * > - * In CNA, spinning threads are organized in two queues, a main queue for > + * In CNA, spinning threads are organized in two queues, a primary queue for > * threads running on the same NUMA node as the current lock holder, and a > - * secondary queue for threads running on other nodes. Schematically, it > - * looks like this: > + * secondary queue for threads running on other nodes. Schematically, it looks > + * like this: > * > * cna_node > - * +----------+ +--------+ +--------+ > - * |mcs:next | -> |mcs:next| -> ... |mcs:next| -> NULL [Main queue] > - * |mcs:locked| -+ +--------+ +--------+ > + * +----------+ +--------+ +--------+ > + * |mcs:next | --> |mcs:next| --> ... |mcs:next| --> NULL [Primary queue] > + * |mcs:locked| -. +--------+ +--------+ > * +----------+ | > - * +----------------------+ > - * \/ > + * `----------------------. > + * v > * +--------+ +--------+ > - * |mcs:next| -> ... |mcs:next| [Secondary queue] > + * |mcs:next| --> ... |mcs:next| [Secondary queue] > * +--------+ +--------+ > * ^ | > - * +--------------------+ > + * `--------------------' > * > - * N.B. locked = 1 if secondary queue is absent. Othewrise, it contains the > + * N.B. locked := 1 if secondary queue is absent. Othewrise, it contains the If we're redoing the comment, please can you s/Othewrise/Otherwise/ at the same time? It catches me every time I read it! Will