Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4232617rwb; Mon, 31 Jul 2023 03:55:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlFZZoUZOJv0u+4+ByHO0+8oV96f2+gk7uIg11qQ9BYZluiRL6oMSnx9b4IpsmWPWf3gPM/q X-Received: by 2002:a05:6a21:798a:b0:129:d944:2e65 with SMTP id bh10-20020a056a21798a00b00129d9442e65mr8944490pzc.13.1690800914585; Mon, 31 Jul 2023 03:55:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690800914; cv=none; d=google.com; s=arc-20160816; b=w/64znayedbk7ktuM2y0b667Rw9/4ND/45iilDZCQKYyFaAEQXRhaamFoMfdIDqU/2 Ydb6smeGIpoyhZ2zRLQwKJaNmUB1QfosS57zQB5RU+virLfm0jOCoyFBHpZvUstoh/wg PdwojD/nfkLRT4MeB8d/VSE/ECfd9Zb2/oM6ZB7ouZ03zJ5s5+T8d0hIxiA5iacf5V9y TwAf6dcJV04S5W1dAT0pxGUtV+ay5HnuGzM5hn0NNQOHbFTdq2p9f0XrPSe/Ucl7a7qR ZioDdVPnbFgPxI5Zg3cIh3DEE8LZ4pSXlQIMvhfD/jxyNlh7Y8lTOclijeHZ/vc+87c6 bPzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=aHauVeZyHeOty4VSja8Lqk+P82eVZyuuz9EVddJy8Rc=; fh=XGK3MdhJUDFgFs9SGHh60iJqwO7C1RHzIMo1/98bRiM=; b=OCZHiw+Ffwr4Z7dd1qm32GCW43ICUiLPuOtZeWam7pLKPd1LlETbmuGLlCLNm682J0 VxryVFQAM0j+27p4ZOPe362RZXkIMU6AOMjJfB9Nsn3BksFTjLtDvVbz8FFZWgIRkUME V82OebbI+KWIPHjqTC2NSeRmHbdpi2asewUq6jBhvVo/w5bClwMRhFWnKzI4wpihvk09 oAG7npy/9AgFOaGW9+ZVnqVSpGHgag3IIlK8CHhKBDMwpP0c+ePyi6ZcOGAFkGOlO7L0 p4u7DgmqNhtmbxk0l4Qzp5ETqI99h44jKM7LwS5v2jrQYCBVOVsf291B2U6y/6O6pasf Y8pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LYf2e2k2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q9-20020a056a00088900b00686f351bdf3si7283647pfj.294.2023.07.31.03.55.02; Mon, 31 Jul 2023 03:55:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LYf2e2k2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231598AbjGaJ5I (ORCPT + 99 others); Mon, 31 Jul 2023 05:57:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbjGaJ4q (ORCPT ); Mon, 31 Jul 2023 05:56:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 942EEE49; Mon, 31 Jul 2023 02:56:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2852360C20; Mon, 31 Jul 2023 09:56:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7506C433C8; Mon, 31 Jul 2023 09:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690797388; bh=r6d0QvBm5c3aVqIjW/FjofLf6a13RLH6NmOQw7Kne68=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LYf2e2k2bvNFUNfHRA7/KmU1Qs9xCMChe2rHHHCrlhiMgB8lzjmPhSkk2Ba5+Upwz sb9HnepDhjH0fIaoNcj6rZZMTomzNxJSJv232Q5A1hDDv+VNQ9Vs0XM8LtIq9Yt9GX f4kohnPm2aQA1MmU48jz+StoQ+lQ7n1pp7f1OW8NYfQKGRMxvBnEIbr0+Q9kE+r9Fs XIPNF/vfUtWtIDku22RV9vAJKoGuhO4y8/Sw4MC2AeL/ZNPW/Uoe2iKEqdmeH3sJdM t5UuHOZTO2m1nHkvH8H0uKhm+Y8M5QXaf9iXqcjLUBLQKBblWEDNOph4LYTy+BzBxA 6Bd9Dpym9xRgA== Date: Mon, 31 Jul 2023 10:56:23 +0100 From: Will Deacon To: guoren@kernel.org Cc: David.Laight@ACULAB.COM, peterz@infradead.org, mingo@redhat.com, longman@redhat.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Guo Ren Subject: Re: [PATCH V2] asm-generic: ticket-lock: Optimize arch_spin_value_unlocked Message-ID: <20230731095622.GA24621@willie-the-truck> References: <20230731023308.3748432-1-guoren@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230731023308.3748432-1-guoren@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 30, 2023 at 10:33:08PM -0400, guoren@kernel.org wrote: > From: Guo Ren > > The arch_spin_value_unlocked would cause an unnecessary memory > access to the contended value. Although it won't cause a significant > performance gap in most architectures, the arch_spin_value_unlocked > argument contains enough information. Thus, remove unnecessary > atomic_read in arch_spin_value_unlocked(). > > The caller of arch_spin_value_unlocked() could benefit from this > change. Currently, the only caller is lockref. > > Signed-off-by: Guo Ren > Cc: Waiman Long > Cc: David Laight > Cc: Peter Zijlstra > Signed-off-by: Guo Ren > --- > Changelog > V2: > - Fixup commit log with Waiman advice. > - Add Waiman comment in the commit msg. > --- > include/asm-generic/spinlock.h | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) Acked-by: Will Deacon It would be nice to see some numbers showing this actually helps, though. Will