Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp557977pxj; Thu, 10 Jun 2021 07:21:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzE4BPjN6hmZx9hQ0lX9dO0Fogjd28wJgRiEDVtRRlyEnZLAtrU3lMq0SBQenzHIWgrl9P0 X-Received: by 2002:a05:6402:201:: with SMTP id t1mr5039782edv.149.1623334910651; Thu, 10 Jun 2021 07:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623334910; cv=none; d=google.com; s=arc-20160816; b=vVT+mrvIh/PYpdf+ET3jzVHX8hdrF9AR2dZ+oDX4dqQKiMsHVU56QnCbvCw5idD3JQ BCp/TJbSPLX5metjT/OEU9TCalqno4wOJ0D4YOIDde5AuJjrJDJ2SrylEX8YFUOGsFTw G1gzOs1ZBog1ueBal7ElR1NTLzRgHva2eAuEr8NI+gO6C+3vV+7a7xnT8ekT4fw8Ug1v 4aLIFrdtH0Y1sqYVECm1ForstgFILNsm/po2N+e/QNvh59Jb+zu/Uo+UFNGZ6lssyiEi bFJKmmQvRjSio7JWP3I/XXmRs/oxJ2IJ4bLGhsSwFJUhLoHDnCt6Jxog+tZcmrphv9Qc f9tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2ettsBbd343DElYNQaOh/2OpHE71CrjjsdmVGaKy6xw=; b=TJ27deXE8/p38u13LOwmfc98XHm2DebuSKBKMuZQq8A9R1tjrl4yQ+7Lkt9JnIAU0v YCz3Qi0E396s2t1FSR6b/s5cQVHHWrHadbXTPCMlkRuUHWpnvJKnlU6mJtWn6XZ8Stsv finK8ugXRYm8VUXj2jfzu6Oz145cA8PuA1xJHGMjxQlwxiSNLjbVsCXdme66sYLzHvbz AvtRCU8UAdN4ot/4936V9irgGcQzSCxXUAXkl13j3Jq9huYhzWPypCdIjbznwSAPzQNH xPfyGXHQ9Hx/HZt2aXRy4k4LUphBgVDFhe9gyB6bg7JE8wVQlDr6vGNx0P9XzpfKPlEy DMpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UOE1Jj3H; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r8si2447057edm.79.2021.06.10.07.21.27; Thu, 10 Jun 2021 07:21:50 -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=@redhat.com header.s=mimecast20190719 header.b=UOE1Jj3H; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231339AbhFJOTg (ORCPT + 99 others); Thu, 10 Jun 2021 10:19:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23527 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbhFJOTg (ORCPT ); Thu, 10 Jun 2021 10:19:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623334659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2ettsBbd343DElYNQaOh/2OpHE71CrjjsdmVGaKy6xw=; b=UOE1Jj3Hh9z2MsSSyVHJWTuTEvfi35bRA437/ZcEHZTqo3P1G64yPcDZ+vBlm42qgOQEV+ mMNh/rgT9LbGNIl0V6Guwyq+WeYQNc1Q8Lld9l6BzYYp82RTuKz6w+IpmUWYSiEboNWzwW n6ywapyHqbomghBjmMKIR7Fdx1nTFvY= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-CvN1yRumOnmgnNpKuchCMA-1; Thu, 10 Jun 2021 10:17:36 -0400 X-MC-Unique: CvN1yRumOnmgnNpKuchCMA-1 Received: by mail-qv1-f69.google.com with SMTP id ce7-20020a05621403c7b0290238a4eac5c4so5565259qvb.13 for ; Thu, 10 Jun 2021 07:17:36 -0700 (PDT) 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:message-id:references :mime-version:content-disposition:in-reply-to; bh=2ettsBbd343DElYNQaOh/2OpHE71CrjjsdmVGaKy6xw=; b=Lb1lTOnMmMD634Iq/2eA3g+JF1YhgLqiVRw2otjF8bFlKYRCVwRojhC5fBmA5mE34M gmVUOJIAeiKlZWNjJZF5xaLHH28fWSASKLsVGRn89PX6yYPErfQSOoc39THPwBDlSa0Y /8C4gfILWCA9pyCpylitOWTXR+FQzIy9+wZSa5Bh3vOwFVWDALboVFvbjWSlZrw/dN7U 8eXb3cPeEqRwkYo6uA1KQpp/hE63t/aJp2R2TBuPeA5MjrryIcABzBbJWzoyIqvemGzG 8/I5X8kaT2Egvj0JX1jfPnmPrZSuIgpfiCWSYT0943Acn/fKA3N03/m585GRnL7opna0 Gl9A== X-Gm-Message-State: AOAM530+cZg4KNnw48OgnpkjCnbc/sqU8XrlNag+n6jawT01F58TUefe tQ1dJMoM3LrwGDafnEMorsrftyjtERIzLLMMarkbJa/qbN/+ScBF09JllWg2ajAPoHA7Z2NE7Bt mEhq+afikhXSNOtSzjOEeSzWK X-Received: by 2002:a37:2fc3:: with SMTP id v186mr4893540qkh.28.1623334656091; Thu, 10 Jun 2021 07:17:36 -0700 (PDT) X-Received: by 2002:a37:2fc3:: with SMTP id v186mr4893513qkh.28.1623334655890; Thu, 10 Jun 2021 07:17:35 -0700 (PDT) Received: from t490s (bras-base-toroon474qw-grc-88-174-93-75-200.dsl.bell.ca. [174.93.75.200]) by smtp.gmail.com with ESMTPSA id q18sm2271315qkc.27.2021.06.10.07.17.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 07:17:35 -0700 (PDT) Date: Thu, 10 Jun 2021 10:17:34 -0400 From: Peter Xu To: Hugh Dickins Cc: 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 Message-ID: References: <589b358c-febc-c88e-d4c2-7834b37fa7bf@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Reviewed-by: Peter Xu Thanks, -- Peter Xu