Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1074955rwi; Mon, 31 Oct 2022 10:52:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kl+fD/o2XkAzRzJzAlbPwGe7oQc8M1OnhQh4WTaN3Hj5Q6S4IAkH3arIWy5Au4nTH5kVX X-Received: by 2002:a17:906:846d:b0:7ad:90dd:4b6 with SMTP id hx13-20020a170906846d00b007ad90dd04b6mr13799182ejc.492.1667238755612; Mon, 31 Oct 2022 10:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667238755; cv=none; d=google.com; s=arc-20160816; b=WfBmyWsSWLrkWinVb4Na41SnNbKj8hzvcTFO78u7+iRxGEMVoZs+WFU/HON3z9b8eY e3r58enBHqZ23u4MtcK7YPYq/8NtN2Qd0eRwySdWQpKGkTALNs85H8au+kLuE7GmAu78 UKDLndQHI+EA/JYtB2zr44ZQztyhMuwT/3vJ++hCyQGEEjN0FkyE3hZ3pOUYR2YpDCOk tLIMFvPlRovLXCUYU/I6SrXwmxoFt7IWm7k4y51wCCQfSDJiMQGxJMsPK18s5JIkkxHh 2sQvcK8lDVLeScERO1UzQoLwPOu3vWAyxVaHHjD5hycwuBVt4C/ynNW4o3bpdKPJ6uIJ JMfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=bVoym53aP4ff+z3FOoG5jl2g45mYf6RnCpQn2di8eJo=; b=L9WG82Ur23f91jsfPJEciKQvO5mYVeiTVtwXepCBqoWoz9mC7B+MDTJ5oiplRJNJfU KSWPrAA7bL3dQDUMWn+csMUyGmVrl8xnfSA78LkHIkJ60vdls2cfOvP5z9uvGqU8PEwa 6WHMpFHZzXD6No+XERQT1DBIWJgHsHghKYs5CEaDe8tinPkLCEXplzVNqjl6dZc892Pt +I1xV7h/tK8airN/Ro/FMxY+uQZZBJOcGXOKks6jJEGBeNY3oMeeU9OeE/RfHWk3UvxV LYJGMY69yILX0NMmwSO6HbPv7qywjKOdKBU8NQ3/EmALElsLVahF2TCoouaL/w5tZCAG sZtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=T56lY+eF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s27-20020a50d49b000000b00456964d3369si7853406edi.230.2022.10.31.10.52.11; Mon, 31 Oct 2022 10:52:35 -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=@linux-foundation.org header.s=google header.b=T56lY+eF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229718AbiJaRhZ (ORCPT + 98 others); Mon, 31 Oct 2022 13:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiJaRhX (ORCPT ); Mon, 31 Oct 2022 13:37:23 -0400 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37A631209B for ; Mon, 31 Oct 2022 10:37:20 -0700 (PDT) Received: by mail-qk1-x735.google.com with SMTP id 8so8044481qka.1 for ; Mon, 31 Oct 2022 10:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=bVoym53aP4ff+z3FOoG5jl2g45mYf6RnCpQn2di8eJo=; b=T56lY+eFVQT6wo4ittAe0G4dhERg4tyWGyylnPI0H0GxAg+OlwxMOlCbWh5QFV4ubU PvA4puiCG3uFaIM9XbM8VMI1Ao/hPNCPIlMChrSiJH9o3YuFKN6q9oIE2b9adfkNYqNz BN3E4lesGWlRKxqyFYzhnZcv9MHu01QlYr6J8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bVoym53aP4ff+z3FOoG5jl2g45mYf6RnCpQn2di8eJo=; b=ktyjHBtxKmaWzmyRPRbajw9QN/jofts6PgUpb0GDOKpsoJXveD3cFBbiuSZNS4W9g5 aVwBhfsPHRnjQVeT1vUh+UUDx3jLAZG0r5bws1QJ2LANkivI258tL7CA35rVnC+SCVyB LQ1WKXeYIH3QaaTVNEEa4+2btEQ4ZkSGWBMRfzvimPWXHu1T5Vkcq87mbaB9oPH1Il09 +J+040XhdN7HJaXC/qcD5JJ9u5pqsAhpER89bV2F28Mn9q2uNdVDWiukB0IqEONO8C7c VNkPGRH4whOoYvIgg6qVj4ra5l7CZd/wdi3Ll6Hoee25PXuTinzVG07858mnyJqSKSM2 7shw== X-Gm-Message-State: ACrzQf19sDCHwB9SQbHF7dPOWFeJUp5iQA38uv6dipkjZ0u5oZNVuJ/S tvDjKqakMj6KihAH80AM/d5tC2IgL7v0Rw== X-Received: by 2002:a05:620a:662:b0:6f8:82a6:d6ea with SMTP id a2-20020a05620a066200b006f882a6d6eamr9891722qkh.133.1667237839071; Mon, 31 Oct 2022 10:37:19 -0700 (PDT) Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com. [209.85.219.172]) by smtp.gmail.com with ESMTPSA id bs6-20020a05620a470600b006b61b2cb1d2sm5098163qkb.46.2022.10.31.10.37.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Oct 2022 10:37:18 -0700 (PDT) Received: by mail-yb1-f172.google.com with SMTP id r3so14512355yba.5 for ; Mon, 31 Oct 2022 10:37:18 -0700 (PDT) X-Received: by 2002:a25:bb02:0:b0:6ca:9345:b2ee with SMTP id z2-20020a25bb02000000b006ca9345b2eemr2660948ybg.362.1667237837692; Mon, 31 Oct 2022 10:37:17 -0700 (PDT) MIME-Version: 1.0 References: <20221031171307.2784981-1-jannh@google.com> In-Reply-To: <20221031171307.2784981-1-jannh@google.com> From: Linus Torvalds Date: Mon, 31 Oct 2022 10:37:01 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] fs: add memory barrier in __fget_light() To: Jann Horn Cc: Al Viro , Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Will Deacon Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Mon, Oct 31, 2022 at 10:13 AM Jann Horn wrote: > > If this is too expensive on platforms like arm64, I guess the more > performant alternative would be to add another flags field that tracks > whether the fs_struct was ever shared and check that instead of the > reference count in __fget_light(). No, the problem is that you should never use the "smp_*mb()" horrors for any new code. All the "smp_*mb()" things really are broken. Please consider them legacy garbage. It was how people though about SMP memory ordering in the bad old days. So get with the 21st century, and instead replace the "atomic_read()" with a "smp_load_acquire()". Much better on sane architectures. Linus