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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C00C0C52D7B for ; Tue, 13 Aug 2024 19:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:Message-ID:In-Reply-To:Subject:cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ea3yNX25t1HlOj5Tx99qiVPGH8h4hKqQJcVcDcbd3i0=; b=GtPsFznxO7703N09pmTk4NVFFQ KeikFDJpDSgtspYOtsf0Lz6DtHUoRebyJp5P/DhSlCQ6W5/Qe7zlkQxuubiOQ97r7o6R3o9CvxgAQ gdhUYkEzirNoLTIrM0cqQoPPNDQY+qiCgnHnmD7UCLfPTtF6PU9aKMWvA8c3/UNYddw6V0y0q9Eva LF/faRKG8oQdBRHco9VU16U7wVWD6ilLSdE/4FHU8tj7U5+QMnyXifOZ+eAmXwoy63fKxH512YDJB 3yi1NlpW3OBkuCI9tMh9KCgGdLJVsfyL8mx7kOqFfhXtBUpW0hY4O2ffoXHMYlu0PGWBiSnYIdx0o QR1M5gGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdxWd-00000004nbP-18wc; Tue, 13 Aug 2024 19:49:47 +0000 Received: from gentwo.org ([62.72.0.81]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdxVk-00000004nSx-2fii for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 19:48:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gentwo.org; s=default; t=1723578071; bh=ujAzKhvz2m85q9OKAVeMysx4OHTHQ3MJssBelvEs0NY=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=BBZbZ+SztijdgLY0TVQ4M0iRQlHQ6u/Nwv47FTIhHi+NOoipKuvuKsatk71urBcSe wlzbeGoJLodwSmPqxRRmsq4vA/S9cf/zhRHMIQer3+HAuxE2We2FnUXCGm9zll7Cwb rcw5wy29kaG9Va/LST1S0Ckm4qguoFdl2EQWk0e0= Received: by gentwo.org (Postfix, from userid 1003) id 5B852400CA; Tue, 13 Aug 2024 12:41:11 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 5A5CD400C5; Tue, 13 Aug 2024 12:41:11 -0700 (PDT) Date: Tue, 13 Aug 2024 12:41:11 -0700 (PDT) From: "Christoph Lameter (Ampere)" To: Waiman Long cc: Catalin Marinas , Will Deacon , Peter Zijlstra , Ingo Molnar , Boqun Feng , Linus Torvalds , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH RFC] Avoid memory barrier in read_seqcount() through load acquire In-Reply-To: <183ee6fa-1d42-4a01-8446-4f20942680d2@redhat.com> Message-ID: <147572ea-c5ae-7992-6015-3181f10a785e@gentwo.org> References: <20240813-seq_optimize-v1-1-84d57182e6a7@gentwo.org> <183ee6fa-1d42-4a01-8446-4f20942680d2@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240813_124852_749556_51249C23 X-CRM114-Status: UNSURE ( 9.45 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 13 Aug 2024, Waiman Long wrote: > Do we need a new ARCH flag? I believe barrier APIs like smp_load_acquire() > will use the full barrier for those arch'es that don't define their own > smp_load_acquire(). Well this is a load acquire instruction. The fallback of smp_load_aquire is: #define __smp_load_acquire(p) \ ({ \ __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p); \ compiletime_assert_atomic_type(*p); \ __smp_mb(); \ (typeof(*p))___p1; \ }) Looks like we have an acquire + barrier here. > BTW, acquire/release can be considered memory barriers too. Maybe you are > talking about preferring acquire/release barriers over read/write barriers. > Right? Load acquire is a single instruction load that does not require full barrier semantics for the critical section but ensures that the value is loaded before all following. Regular barriers do not have this singe load that isolates the critical section and sequence all loads around them.