From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH v2 3/5] locking/qspinlock: Introduce CNA into the slow path of qspinlock Date: Wed, 3 Apr 2019 18:10:03 +0200 Message-ID: <20190403161003.GL4038@hirez.programming.kicks-ass.net> References: <20190329152006.110370-1-alex.kogan@oracle.com> <20190329152006.110370-4-alex.kogan@oracle.com> <20190401090653.GF11158@hirez.programming.kicks-ass.net> <20190401093345.GA14281@hirez.programming.kicks-ass.net> <7A8A6827-BF79-47FC-99A1-C9EE00D9C3B1@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <7A8A6827-BF79-47FC-99A1-C9EE00D9C3B1@oracle.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Alex Kogan Cc: linux-arch@vger.kernel.org, arnd@arndb.de, dave.dice@oracle.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 List-Id: linux-arch.vger.kernel.org On Wed, Apr 03, 2019 at 11:53:53AM -0400, Alex Kogan wrote: > > One thing we could maybe do is change locked and count to u8, then your > > overlay structure could be something like: > > > > struct mcs_spinlock { > > struct mcs_spinlock *next; > > u8 locked; > > u8 count; > > }; > I was trying to keep the size of the mcs_spinlock structure for the non-NUMA variant unchanged. > If this is not a huge concern, changing the fields as above would indeed simplify a few things. Well, sizeof(struct mcs_spinlock) is unchanged by the above proposal (for x86_64). And I don't think it matters for x86, which is very good at byte accesses, my only concern would be for other architectures that might not be as good at byte accesses. For instance Alpha Received: from merlin.infradead.org ([205.233.59.134]:43680 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbfDCQKN (ORCPT ); Wed, 3 Apr 2019 12:10:13 -0400 Date: Wed, 3 Apr 2019 18:10:03 +0200 From: Peter Zijlstra Subject: Re: [PATCH v2 3/5] locking/qspinlock: Introduce CNA into the slow path of qspinlock Message-ID: <20190403161003.GL4038@hirez.programming.kicks-ass.net> References: <20190329152006.110370-1-alex.kogan@oracle.com> <20190329152006.110370-4-alex.kogan@oracle.com> <20190401090653.GF11158@hirez.programming.kicks-ass.net> <20190401093345.GA14281@hirez.programming.kicks-ass.net> <7A8A6827-BF79-47FC-99A1-C9EE00D9C3B1@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7A8A6827-BF79-47FC-99A1-C9EE00D9C3B1@oracle.com> Sender: linux-arch-owner@vger.kernel.org List-ID: 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, tglx@linutronix.de, bp@alien8.de, hpa@zytor.com, x86@kernel.org, steven.sistare@oracle.com, daniel.m.jordan@oracle.com, dave.dice@oracle.com, rahul.x.yadav@oracle.com Message-ID: <20190403161003.Ps2EuP8TMsB8A4DHYjSXrhM1wiIMm6ZsC7cYN1_9XdQ@z> On Wed, Apr 03, 2019 at 11:53:53AM -0400, Alex Kogan wrote: > > One thing we could maybe do is change locked and count to u8, then your > > overlay structure could be something like: > > > > struct mcs_spinlock { > > struct mcs_spinlock *next; > > u8 locked; > > u8 count; > > }; > I was trying to keep the size of the mcs_spinlock structure for the non-NUMA variant unchanged. > If this is not a huge concern, changing the fields as above would indeed simplify a few things. Well, sizeof(struct mcs_spinlock) is unchanged by the above proposal (for x86_64). And I don't think it matters for x86, which is very good at byte accesses, my only concern would be for other architectures that might not be as good at byte accesses. For instance Alpha 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=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT 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 24D4DC4360F for ; Wed, 3 Apr 2019 16:10:15 +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 AB02C206B7 for ; Wed, 3 Apr 2019 16:10:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iOd1cqkM"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="y57sT1dO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB02C206B7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.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=gV2JP3lR+Xbf/ulQcMoQChV3NAqV7+08+S5GetP/wUE=; b=iOd1cqkMEHhMA9 CIK4w4rhd5PKLbZ/qsTIkvg/pysRtimUPmKP6kBJUghU3cdXEIkom37i6K2tYBCpEbNCZ8vlGCAiH BbPZ1wPWbQiiScbLZuqNdvC4Ddpd3leI4RIVjzd1RthNo9TuglgiIHAnFjkjvIdSL2BODjo8K9+Ns 0fY69Fo5N6Flljz5+C4GjEwUl2c+YKsZkZ1Aox0pVvBHk726uroT17KHPEwRsEBrQIVRGDAuWeSKF SHixthOEybvflvZIYrE2BZbE3JYxDwIkPjhbZ8Md5wsrw+sfywk0ls0u5/grSNYduvfswA+OYpJks iAvTA5NPfChcK6l9Rw5w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBiSn-00059B-Sk; Wed, 03 Apr 2019 16:10:09 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBiSl-0004hB-Cm for linux-arm-kernel@bombadil.infradead.org; Wed, 03 Apr 2019 16:10:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=oxctlf33XRUqCqvjvLyuJJ32TcsfAlFm5J/QwPvH0xw=; b=y57sT1dO2KjmuSwmkOuNr/Gyy NIEztjZ0SL9wEXDevahqEBZzDBdEJ5dEA7DzEbfIibjdIX8BjbSt7yeXUM0rbXqsbSTTslqL9VsYn ltC83Ww8awqiUWTzTLTpCZTrJykBBo29+EyFvClbnDavQ6swQGotFpO6gECG0ef+FuzY4Hcdi+AD+ MqDckoRs+1Chp4nrTAF+YlzHgK9AWRQDIEb5e67yqXpWUajT4quBRrEz5pLobpgsezv6VUvXZVfqV UcsCtp5MEkxRE7WtVTu9V3b4Zd07wwb2yFl5mky5Rnx70nY8Xu/suomXeLtyNa23d5B4zl65fNQMy ppi1gwUcA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBiSi-0003s2-Hg; Wed, 03 Apr 2019 16:10:04 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3DF842038D44F; Wed, 3 Apr 2019 18:10:03 +0200 (CEST) Date: Wed, 3 Apr 2019 18:10:03 +0200 From: Peter Zijlstra To: Alex Kogan Subject: Re: [PATCH v2 3/5] locking/qspinlock: Introduce CNA into the slow path of qspinlock Message-ID: <20190403161003.GL4038@hirez.programming.kicks-ass.net> References: <20190329152006.110370-1-alex.kogan@oracle.com> <20190329152006.110370-4-alex.kogan@oracle.com> <20190401090653.GF11158@hirez.programming.kicks-ass.net> <20190401093345.GA14281@hirez.programming.kicks-ass.net> <7A8A6827-BF79-47FC-99A1-C9EE00D9C3B1@oracle.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <7A8A6827-BF79-47FC-99A1-C9EE00D9C3B1@oracle.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, arnd@arndb.de, dave.dice@oracle.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 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 Wed, Apr 03, 2019 at 11:53:53AM -0400, Alex Kogan wrote: > > One thing we could maybe do is change locked and count to u8, then your > > overlay structure could be something like: > > > > struct mcs_spinlock { > > struct mcs_spinlock *next; > > u8 locked; > > u8 count; > > }; > I was trying to keep the size of the mcs_spinlock structure for the non-NUMA variant unchanged. > If this is not a huge concern, changing the fields as above would indeed simplify a few things. Well, sizeof(struct mcs_spinlock) is unchanged by the above proposal (for x86_64). And I don't think it matters for x86, which is very good at byte accesses, my only concern would be for other architectures that might not be as good at byte accesses. For instance Alpha