Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp827821pxj; Fri, 11 Jun 2021 12:36:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpydwE1nPDm/uPq+lehplld6xGce/Sa3ML1CEBoXynFNCrP6gZFuTd0wVZDZvB0L59y9q7 X-Received: by 2002:aa7:d0cc:: with SMTP id u12mr5285236edo.48.1623440181025; Fri, 11 Jun 2021 12:36:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623440181; cv=none; d=google.com; s=arc-20160816; b=m5MqfJR0F+CC3MhjIWBZOujx3J69eJpCIlaGgCasfz3Bm+bCYF1B9J2H29FiN9oXBv x06fKmGhpwFgKhbWWKqSKBbLewQ03OubazShxOdv6u8wrx3oYbQXSn0JzcbJVBfyXfdU N7GLjJgcb8gb5FIoK/FmMp54p7f5WuKfQXfC9Y/6J1hMGYYTCVQZ+PIYwGYXsIyAA2vv coiRtMYUUu75aUiSUEF9W/4PFdqfThqIUb+f2MrOd7OG1QsZDdrsL5VPb5qsjhsxLwKz /tRMxbvNNnwuqWqPC27Na7olbVccIgVzAXHasSZmp7EdBWq0SfgJQHW4vdh/KdCGnppn IVOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=9KC1WlvZCoYfqYiySVqCF52BYldtrMLa/9NrPxZB38U=; b=wED6VCr02UT65o78cNR1Uk2aGUKhIIESkCviR9tzX49u7EsirvVj99LioLGCTuytQS zMznagPQR0+9k5ELj1vnxWEtBTpXEHUnm7XbJsK0EduiwrhflxhYpGWJbLSMkuiYdGcJ USUi7X+kw4MY2tJ6bMKllksIUFza83N79PE4iyjdaeApWvlQfASA+gZACUs1HLL3QYkg 7XCOBcv6ausUBbLffi+bQiRXV3hE/r/0vxp8kh7+qU1/7oZF6KKeLbb6AT4AekwG5SUc l32kFNrfmZyVSB6QdEcsw+me+3z6rXsh+nkQWBETKkbJeBmQU7V0VvNHmKjy24PVVlrD fRfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=s3Mli2zk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si6298661edb.243.2021.06.11.12.35.55; Fri, 11 Jun 2021 12:36:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=s3Mli2zk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230452AbhFKTgR (ORCPT + 99 others); Fri, 11 Jun 2021 15:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbhFKTgM (ORCPT ); Fri, 11 Jun 2021 15:36:12 -0400 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EA10C061574 for ; Fri, 11 Jun 2021 12:34:02 -0700 (PDT) Received: by mail-ot1-x32d.google.com with SMTP id 36-20020a9d0ba70000b02902e0a0a8fe36so4205775oth.8 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=nQqs8F3Wr9uv3vWlzlnEr1WcPsB2tDAaYUp6tl/4ixk5vSqKy9J/2BdFiPbfTSrSVW PzVhtKsK5ctJrP481tI/HNJvbHF35Gph0luTgfGNRwbJlokOK4DWaw/QyXpuAz/ftIGG /WFVddbHvYbWxgkrKDi76Nzy9iCYZp0FasJwQ9adHhIziCIO22gG/vK/1sINyhHuTcJ4 YgjZv7nKuc3OQdBAgrMXYAMyQUkwkct4bDqL/XtUAOJ5tske2Qi+fWEfkWWRzCZnIwF9 9wfAz+RAFxUt3RGjMsmoHkqxYVGi2nXv/dgX/gI7S8YWmIZFRLxitr07Wv2Kgk+4Q/zl /Q6Q== X-Gm-Message-State: AOAM530zrf5SS71Oc24XMuwSQyowKKFhhiS2LqWtDlLYc54/mOKR9/7+ 0EbYLuVT6fnpxraO26SgItylrw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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