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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6D1CC433FE for ; Wed, 19 Oct 2022 17:41:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231193AbiJSRlX (ORCPT ); Wed, 19 Oct 2022 13:41:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231307AbiJSRlL (ORCPT ); Wed, 19 Oct 2022 13:41:11 -0400 Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A97861B94CB for ; Wed, 19 Oct 2022 10:41:10 -0700 (PDT) Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-132fb4fd495so21503308fac.12 for ; Wed, 19 Oct 2022 10:41:10 -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=o7oESz5tomQbWcoWEgo0/iqd576fd8JG2PTmQCWKHUY=; b=LhnaCxQkYe9bL+uXUquBP284q0FFjCfp0v3tEE3Ew7ycTxf8ce+iI79qb3MGCCRuuU zjTJ8I9g99kNf5YqHMJEIgBBUDmx8TSibPKQcCCydysOcjqO4Oy0SigG4t1dTfmwSk9p Q8Xw+hnWgAzZpeoedADsV2vwGfcmjwBSuWbS8= 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=o7oESz5tomQbWcoWEgo0/iqd576fd8JG2PTmQCWKHUY=; b=4WACj2NMiFklvx5MQ2/mT6K0eFxOh3QQeas3GOetKJ/BAsY+7BkwpEnnYRgWDw/CU+ YwfIBKKAUz+g910afD1CNCoGjDoAxhrM/9blj6oQkI3XzORP3kIpieti9uO36zqDebsM DXT8cN8r7HCee7twBkP/pYJ9H4+gbiMqPGMGFZ1hP5zXl3j3mEkyIFig8Z9IWAkLXPrW Xh5oFp/QSkvepjSH84C5ZbgaSRgcEf5kiYA5afgjhner44efC+c9NS4MAkczBajHjGse FDJI2Dqi/lcdWY6ha7jk9qoI3qiVtMy5KHgsWiOWqk0diT4zq+OLwDITUXCHT9uq2WQX K9cQ== X-Gm-Message-State: ACrzQf3tXoS96i3GhQGyj7kbybaYXCgPJcVxmHzYNG5VqohZpkfWxyGk Of37vOPPKThAIaYaPLw9ohRHTmGmm5TBHg== X-Google-Smtp-Source: AMsMyM5T7cDGSIo0V+9GPVoGjJiStdmYSZc+dsYVTwNG2H99512/hegyxrZZ+PSHdbRnYQzvHya7mg== X-Received: by 2002:a05:6870:e30e:b0:132:e934:5c0a with SMTP id z14-20020a056870e30e00b00132e9345c0amr5872143oad.202.1666201269297; Wed, 19 Oct 2022 10:41:09 -0700 (PDT) Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com. [209.85.160.45]) by smtp.gmail.com with ESMTPSA id a130-20020acab188000000b00354978180d8sm6926715oif.22.2022.10.19.10.41.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Oct 2022 10:41:08 -0700 (PDT) Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-1364357a691so21524275fac.7 for ; Wed, 19 Oct 2022 10:41:07 -0700 (PDT) X-Received: by 2002:a05:6870:c0c9:b0:127:c4df:5b50 with SMTP id e9-20020a056870c0c900b00127c4df5b50mr6076270oad.126.1666201256175; Wed, 19 Oct 2022 10:40:56 -0700 (PDT) MIME-Version: 1.0 References: <20220815071332.627393-1-yuzhao@google.com> <20220815071332.627393-9-yuzhao@google.com> In-Reply-To: From: Linus Torvalds Date: Wed, 19 Oct 2022 10:40:40 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v14 08/14] mm: multi-gen LRU: support page table walks To: Yu Zhao Cc: Peter Zijlstra , Andrew Morton , Andi Kleen , Aneesh Kumar , Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Johannes Weiner , Jonathan Corbet , Matthew Wilcox , Mel Gorman , Michael Larabel , Michal Hocko , Mike Rapoport , Tejun Heo , Vlastimil Babka , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, page-reclaim@google.com, Brian Geffon , Jan Alexander Steffens , Oleksandr Natalenko , Steven Barrett , Suleiman Souhlal , Daniel Byrne , Donald Carr , =?UTF-8?Q?Holger_Hoffst=C3=A4tte?= , Konstantin Kharlamov , Shuang Zhai , Sofia Trinh , Vaibhav Jain Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 18, 2022 at 10:51 PM Yu Zhao wrote: > > pmd_read_atomic() should have a built-in READ_ONCE() in the first > place. I really think that is the right thing to do. Let's just move the barrier in *there* instead. It really should use 'READ_ONCE()', but it sadly cannot do that portably, because 'pmd_t' may be a multi-word structure. Of course, the x86-32 code does this all *almost* right, and implements its own version of pmd_read_atomic(), but then sadly does it _without_ actually using READ_ONCE() there. So even when we could do it right, we don't. But the x86-32 implementation of pmd_read_atomic() would be trivial to fix to just use READ_ATOMIC, and the generic implementation should just have a "barrier()" in it so that we wouldn't need crazy barriers in the users. Because as you say, the function is already called "read_atomic", and it should damn well *act* that way then. Hmm? Linus