Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp92066pxj; Thu, 10 Jun 2021 15:50:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu4jZNUzjwFkiZzc2dn0McbpiFnwVBXXFV2JwUOH7Z2soXKR1cNOmu10Ef5N4jNkRwHjo9 X-Received: by 2002:a17:907:3e1a:: with SMTP id hp26mr686157ejc.77.1623365428101; Thu, 10 Jun 2021 15:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623365428; cv=none; d=google.com; s=arc-20160816; b=tL5G4IcDSundIziKLKjDxqaPjVLL4en3xSZvRMzDxiV5WSJdVNM2OXV0pbi1z9wvJF jJtWR3ZT7Kozy6YoGPiNIK43mpufxkZ5fq34VK2oOPteg0jI8k3y4VU28muPKrsoSZ1K o8XyiQSB2VlAHlOZLuZZ2pes2LOM2qybKf9A/yvie/pdA2kEaMWmCBkJfEk+lFfFnGKx K56Dj+eX8SNbW2A6/qnHBammU3NsiHUJZgvVSB8uJLcN6sciiPzMWZ1D26vjk4lcb31b WE65v7QDWYZq1J5OHxpUwyBkawm6jpFChFEamb6glWEofGloDM1udVAA6hBHT/33WQuS 3plg== 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=LrEBkTu83H7Tgc6v8uZSpjIax3E68F6f8T/pUY54qGg=; b=zu0C0WXB0Uk4QgNfiuqgnoCoPnbxzynNeBPwp2rlCne0DD7NGwppbSzjbqZb0Yaok/ pgC5KqI2cX/gymImY917xfqMjGY+CIYS1H2cFNWvxXQY4LJwtTrAZEMndWnjr3JRLIzW MkY6SqOtJipRwCEcq1Y58m8DV+W8rMdYhoEGsglQg6Ls/flhqbsalZEASO/ydKuvM7wL 9epDPdAgQL9ib3cWEZPyRFP3OsVayFMkFFvn0x3vMtxZLQeL4FoNp29uHnIGGVG+eMXy VR4eONfL19XR4YSzI0nU9grBZ3U9MEwB5sIGR6IDhtsRHPjGvdmEfluLpmfbQh/idfwe OxeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="k/rytVQ2"; 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 s18si3725112eji.655.2021.06.10.15.49.49; Thu, 10 Jun 2021 15:50:28 -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="k/rytVQ2"; 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 S230216AbhFJWtE (ORCPT + 99 others); Thu, 10 Jun 2021 18:49:04 -0400 Received: from mail-qk1-f171.google.com ([209.85.222.171]:43693 "EHLO mail-qk1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230103AbhFJWtE (ORCPT ); Thu, 10 Jun 2021 18:49:04 -0400 Received: by mail-qk1-f171.google.com with SMTP id j62so15313518qke.10 for ; Thu, 10 Jun 2021 15:46:52 -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=LrEBkTu83H7Tgc6v8uZSpjIax3E68F6f8T/pUY54qGg=; b=k/rytVQ284fUXmr1w94s7TKB8dvFcGCbJiQLPshA1k9hahCymncZwiJT3ZXlsRLVE7 hhp0cWN8ZDyA0K0sK+LL8J6cgcTUaWlxyMggg8yZPQHAPL8NVeuAn+EVVL1AgO3oULeI OAyehqT1O0aAQWPg8tIy33HHL9tVsBd+dDkZ4ITaCF+Ts99EW2OWZMo/EF0j3Vrc1bMv ZqBjyRd/GR3sEcnl1dFQ6QlrFzvPtfGYyS28viISIRpIcfkC3UwEZmGX9l/T3VYU0S8X AR2+LKpMGb/jxMURdU1/L2jBvaxdU33irPX/WKcDeRx3aH/4Kbpp8GpDrSU3EWMFNMNB mKJA== 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=LrEBkTu83H7Tgc6v8uZSpjIax3E68F6f8T/pUY54qGg=; b=V7ycLrOug47u6TAlgs2sTrvoSQZTvVjCBUrPmq+suRGzh6kP6rnASV+DL96DMvibJk BFIaff/733tnI06qTjurFvjB1I0tbfpa6Y0qby/n5aWl/qZ0jTcsAmzJZD3SWYMMW/yJ WkK8VHwLR74e97WqLLxW1dxrYO51ppzrlS5Ha/l0FmO2i0cFIQ87oB8S48w3eyKa1xwx Ri5T59G+QXCbQQOUEqlxhzeKB6tu48J8UeJKq6uyupxuh4M88+iGH4E26xJw1TaU/i5T PEWbT9yxDbHJmmhloVigzU89+gxLmVYNfi2WHwyASCzPJ7CtU9y+w35eLPkjTllOxQln cg2w== X-Gm-Message-State: AOAM533Ak/DrHdF5LB3TKC7gF+XDLpJM+2BFSnyc3C1Ur84oxszj0SK/ VsHOUBH3/5kK5k/s6Svnamw8KA== X-Received: by 2002:a37:c447:: with SMTP id h7mr968199qkm.63.1623365152225; Thu, 10 Jun 2021 15:45:52 -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 16sm2248459qty.15.2021.06.10.15.45.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 15:45:51 -0700 (PDT) Date: Thu, 10 Jun 2021 15:45:49 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Peter Xu cc: Hugh Dickins , Andrew Morton , "Kirill A. Shutemov" , Yang Shi , Wang Yugui , Matthew Wilcox , Alistair Popple , Ralph Campbell , Zi Yan , Will Deacon , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/11] mm: page_vma_mapped_walk(): settle PageHuge on entry In-Reply-To: Message-ID: <52648396-6217-52a7-51e0-294863b5329c@google.com> References: <589b358c-febc-c88e-d4c2-7834b37fa7bf@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 10 Jun 2021, Peter Xu wrote: > On Wed, Jun 09, 2021 at 11:36:36PM -0700, Hugh Dickins wrote: > > page_vma_mapped_walk() cleanup: get the hugetlbfs PageHuge case > > out of the way at the start, so no need to worry about it later. > > > > Signed-off-by: Hugh Dickins > > Cc: > > --- > > mm/page_vma_mapped.c | 12 ++++++++---- > > 1 file changed, 8 insertions(+), 4 deletions(-) > > > > diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c > > index a6dbf714ca15..7c0504641fb8 100644 > > --- a/mm/page_vma_mapped.c > > +++ b/mm/page_vma_mapped.c > > @@ -153,10 +153,11 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) > > if (pvmw->pmd && !pvmw->pte) > > return not_found(pvmw); > > > > - if (pvmw->pte) > > - goto next_pte; > > - > > if (unlikely(PageHuge(page))) { > > + /* The only possible mapping was handled on last iteration */ > > + if (pvmw->pte) > > + return not_found(pvmw); > > + > > /* when pud is not present, pte will be NULL */ > > pvmw->pte = huge_pte_offset(mm, pvmw->address, page_size(page)); > > if (!pvmw->pte) > > Would it be even nicer to move the initial check to be after PageHuge() too? > > if (pvmw->pmd && !pvmw->pte) > return not_found(pvmw); > > It looks already better, so no strong opinion. It hadn't occurred to me to move that. I probably wanted those two "The only possible mapping" comments near each other. I don't see any particular reason to change them around now - beyond the title saying "settle PageHuge on entry", whereas this is a few lines after entry! Let's leave it as is. > > Reviewed-by: Peter Xu Thanks, Hugh