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 X-Spam-Level: X-Spam-Status: No, score=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 A0892C48BD1 for ; Fri, 11 Jun 2021 19:34:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F0A5613CC for ; Fri, 11 Jun 2021 19:34:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F0A5613CC Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A1F236B006C; Fri, 11 Jun 2021 15:34:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9CEE76B006E; Fri, 11 Jun 2021 15:34:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 848546B0070; Fri, 11 Jun 2021 15:34:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 4E3DA6B006C for ; Fri, 11 Jun 2021 15:34:03 -0400 (EDT) Received: from smtpin39.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id DACB58249980 for ; Fri, 11 Jun 2021 19:34:02 +0000 (UTC) X-FDA: 78242443524.39.45523B0 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) by imf26.hostedemail.com (Postfix) with ESMTP id E5CBE4202A19 for ; Fri, 11 Jun 2021 19:33:58 +0000 (UTC) Received: by mail-ot1-f51.google.com with SMTP id 69-20020a9d0a4b0000b02902ed42f141e1so4235619otg.2 for ; Fri, 11 Jun 2021 12:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=9KC1WlvZCoYfqYiySVqCF52BYldtrMLa/9NrPxZB38U=; b=s3Mli2zklAXF+ZbXmuW9tm1ImNKrtBdKTHxo/PFxqVNnoah48XzwpEIZBMnd3V3Bzk d4SA4+7LYVF7HdkzXFdfEFXeYyrRYEoWVaCkLBvj2LuQzqy5coz8nmMhvtcaoymwBF0P +3fT5OtAluNA+zY3kKlsD/nqQ67NdjxtXJWbWV8rDR8PXcpeD8pqRItA4uRqhnSdDF++ Le/f6nA88n/quDVoWVyUQDlTVeEijeMp048FBJFZ2yVJGRBdjSvaJfa8IH7U4eQyiqzk BdPh+Rl+/vVhG+knNsZTYSwGyMkc4/xCdQG0l1Ow+/vg5QstK9tGTpht8vQaInB2XdbG w90g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=9KC1WlvZCoYfqYiySVqCF52BYldtrMLa/9NrPxZB38U=; b=fuZYUwewuScvcrkzFbP4MrSNTiAjDApxC7VL4kPXRP3UeQevC0AY1iGJQgdgwOIUG3 HXC0MD1KZJsudDlyeTr077LdqdO3U4lGBZDJuR1kNlZ879qDU8BHMSmdMwkdpXM0F9hY gofYe9/9pdcadKcRRoBRQj1UTl3+DFkA9pS3ayjoSfaSdjkwCb+l4jc3tqabywuDPNf9 H6Wagx23IlJjgzQefNGRA2cA1ppL7bmsLx17jIi9tSV/T7aZaNTboTyqFmUVGUhq0ziF ZnGnD0Gs8QLVCEy0cTk8Ub7DmifFdV6YF/e9TK1JtYXmy//FXjKncmwg4biomxLYd4X8 +V/A== X-Gm-Message-State: AOAM530RdfV+Ijwu3daUM74pCW0Om970T6crr/p5thKc/etWjyknN5B2 R1sN9+BmQBOrJ49lKj3lQl3/pA== X-Google-Smtp-Source: ABdhPJxOUhBU+bQdZhK5J/qK2+/M+sj1IXnZgj4uy8bYedMJf0BZ2BvegiL+1874ZuiIeHMbp479Og== X-Received: by 2002:a05:6830:168e:: with SMTP id k14mr4529195otr.280.1623440041630; Fri, 11 Jun 2021 12:34:01 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id w4sm1473227otm.31.2021.06.11.12.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 12:34:01 -0700 (PDT) Date: Fri, 11 Jun 2021 12:33:58 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Hugh Dickins , Jason Gunthorpe , "Kirill A. Shutemov" , "Kirill A. Shutemov" , Yang Shi , Wang Yugui , Matthew Wilcox , Alistair Popple , Ralph Campbell , Zi Yan , Peter Xu , Will Deacon , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/11] mm: page_vma_mapped_walk(): use pmd_read_atomic() In-Reply-To: <20210611153613.GR1096940@ziepe.ca> Message-ID: References: <589b358c-febc-c88e-d4c2-7834b37fa7bf@google.com> <594c1f0-d396-5346-1f36-606872cddb18@google.com> <20210610090617.e6qutzzj3jxcseyi@box.shutemov.name> <20210610121542.GQ1096940@ziepe.ca> <20210611153613.GR1096940@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E5CBE4202A19 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=s3Mli2zk; spf=pass (imf26.hostedemail.com: domain of hughd@google.com designates 209.85.210.51 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: bfb4cf1n8niakoy4jn7pi46syd1bbf6q X-HE-Tag: 1623440038-300372 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, 11 Jun 2021, Jason Gunthorpe wrote: > On Thu, Jun 10, 2021 at 11:37:14PM -0700, Hugh Dickins wrote: > > On Thu, 10 Jun 2021, Jason Gunthorpe wrote: > > > On Thu, Jun 10, 2021 at 12:06:17PM +0300, Kirill A. Shutemov wrote: > > > > On Wed, Jun 09, 2021 at 11:38:11PM -0700, Hugh Dickins wrote: > > > > > page_vma_mapped_walk() cleanup: use pmd_read_atomic() with barrier() > > > > > instead of READ_ONCE() for pmde: some architectures (e.g. i386 with PAE) > > > > > have a multi-word pmd entry, for which READ_ONCE() is not good enough. > > > > > > > > > > Signed-off-by: Hugh Dickins > > > > > Cc: > > > > > mm/page_vma_mapped.c | 5 ++++- > > > > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > > > > > > > diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c > > > > > index 7c0504641fb8..973c3c4e72cc 100644 > > > > > +++ b/mm/page_vma_mapped.c > > > > > @@ -182,13 +182,16 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) > > > > > pud = pud_offset(p4d, pvmw->address); > > > > > if (!pud_present(*pud)) > > > > > return false; > > > > > + > > > > > pvmw->pmd = pmd_offset(pud, pvmw->address); > > > > > /* > > > > > * Make sure the pmd value isn't cached in a register by the > > > > > * compiler and used as a stale value after we've observed a > > > > > * subsequent update. > > > > > */ > > > > > - pmde = READ_ONCE(*pvmw->pmd); > > > > > + pmde = pmd_read_atomic(pvmw->pmd); > > > > > + barrier(); > > > > > + Andrew, please drop this patch from your queue: it's harmless, but pretending to do some good when it does not. The situation has changed since I originally wrote it, gcc min version has been raised, Will Deacon has corrected the applicability of READ_ONCE() to pmd_t in April 2020 commits, pmd_read_atomic() is not as magic as I thought (it has good uses but not here), and the commit comment is no longer right. However... if you're nearing the point of a fresh mmotm, probably best to leave it in for now and we sort out the mess later. Because although it's functionally independent from the other patches in the series, there is of course the "indentation" patch, and this falls in the middle of what's indented a level there. I don't imagine that will tax your abilities to their limit, but after that there's the main bugfix patch, which expects a blank line I added in this one, that's no longer there when reverted. Enough to make me sigh, and just write to say "drop, when you have time". Let me know if you'd prefer a resend of the series (today? not sure). (Discussion of pmd_read_atomic() and barrier() and mm_find_pmd() and suchlike may continue in this thread, but this 03/11 should just be dropped. Whether it's in or out should not affect Alistair's series.) Thanks, HUgh