Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp7224684ybc; Thu, 28 Nov 2019 13:24:05 -0800 (PST) X-Google-Smtp-Source: APXvYqyH//bQIQfcs9PNr+cnnijaDqyMD+XJfu8RmDfzg9oSYtmBuXVAjr/Baq85BYdO1IsA697b X-Received: by 2002:a17:906:6847:: with SMTP id a7mr30960407ejs.95.1574976245744; Thu, 28 Nov 2019 13:24:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574976245; cv=none; d=google.com; s=arc-20160816; b=hbW63DImqwZeOIazOUUg3zKBUbm4G1Llx3ws7ZNvbaPwgvpNRVmv4Rzchq5QfLo1T5 RBqGFHIaMU0Jo1jwzrYNRIgt/oTFqj6BOdLD2eNt+lE0Gtz/HVG9CN8fQ9kgSYeNdts+ ho7mp6NFoB2Mlgr5rniYCAEP/9nh1u5yJqfe+Me9ErOb0/FfgwqU7ynkHFlW8a+yOZfz pulOXltOpILtn/1SBB+vx/v9NaUynToeGMexRRdLO/GrEShhcUtZab/8EVj/brHTP2Os zhmAx+KPJvljqMln2CH26NrlZtff+QR2yqhz5Z5GINNIwggBkYfU67G5cgJ7nGjr6ojb +Z/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=zacUhBiF0D2r1M/XEfL2iZtJ1q7R7ytzGKqkS9NCn0w=; b=QpDL8TvN0v+xeoCQXagifHEuzjp29qcHxku8YAo7rwP/4JYfrW9ACEoeifQqbI9864 soo2i6qm0ADNBqg3qHN2VkkPw9J07RbejcCpMQgmgvlbHaQusnJxaBI7vFLF6H2tqYfs M7F+WafFshsRiiNk8Ou22lINZkzuf0I38/MO9rQFJMR+8Y8wY/GVS2yjV3lIDOtR7NsX W2j03EcZo6fmyJoYVXMFQp15QzA9AXfuJpmEiafrvm7qoA4ev8UAk1UO41kGe4hmT2R+ O0i3wM4DPi9zR1fiD8vRIVne8xiohltR14hCnDgPj5w9STIMTsjWXEbqlacKYynJaZqI WMlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N9am0Efc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17si2957449ejj.5.2019.11.28.13.23.41; Thu, 28 Nov 2019 13:24:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N9am0Efc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726648AbfK1VWa (ORCPT + 99 others); Thu, 28 Nov 2019 16:22:30 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36273 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbfK1VW3 (ORCPT ); Thu, 28 Nov 2019 16:22:29 -0500 Received: by mail-wr1-f67.google.com with SMTP id z3so32645370wru.3 for ; Thu, 28 Nov 2019 13:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zacUhBiF0D2r1M/XEfL2iZtJ1q7R7ytzGKqkS9NCn0w=; b=N9am0EfcOq6pRgS/6stJ1kOB9hXFjaOE1psdZlacG0Q2+zMuIfHGvuGUDf9g02SPdw 8+HwHtp7YT1jKWgqM3g+DLTVRgSfNjLlsHsUdpoVYAbSHQGa4puCc9aNmE1a9GLVqNAi iCtrX6lkyMohQWMFo6hJBneJu3yJz9GqeTbEVHFpKxV2pf0vjemgJN1BMFKA7sMdh7+P JpEw94EjxA5uEv1p7POXpxtLeCOB0xI0yZ7RBnAU+FyoPNzluCSJBWVMJCO8GNy4S9Pd JDoXHleDmU+d/x8TErQRg+gyELXyHkv3+pQfeZgyqNp1hW4mlPk/1iV6nRT4F7FsguRm iwtg== 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:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=zacUhBiF0D2r1M/XEfL2iZtJ1q7R7ytzGKqkS9NCn0w=; b=VyQYSIqngSmaP5SXgsyJvRd7FR1TV4r9ts2yUIiA7ijKOX21Zwt13usddlmBNBQHwM EZMEyLnFB2dZFPK+YkbuH+jmppYXvC2lzz45Os1gEb9nrk/IlBLQUG8TB+y1pYErs+4R 09Fjq/eip8LT2bahNhg+xE6d7Ob/0OjACTFaErQk08FSfj9xXugLDXNMxBnEJrMgqTb3 dLvCHytJXzLDgHQhGjio34VPJ0e4HQAyyQ+YvqN9d4E+NuFUzS7z4q7rNJxjVUFLbXiA gGVlTXIpX+PduG1pv2kKo/dmfWfpFMc6OzXfDiU6kDS1Dyo0aGluGt+BACL8MWV8TyZz /agg== X-Gm-Message-State: APjAAAVLx9iUDjX5UBJptN7PnTRMVK9fvzz9UIziL7jp70rPZgEDaojd dFOL24ur7ewgHHs+yjPU7ehKaKeH X-Received: by 2002:a5d:474c:: with SMTP id o12mr51701274wrs.170.1574976147572; Thu, 28 Nov 2019 13:22:27 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id b8sm24301877wrt.39.2019.11.28.13.22.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Nov 2019 13:22:26 -0800 (PST) Date: Thu, 28 Nov 2019 21:22:26 +0000 From: Wei Yang To: "Kirill A. Shutemov" Cc: Wei Yang , akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] mm/page_vma_mapped: use PMD_SIZE instead of calculating it Message-ID: <20191128212226.sfrhfs5m3q7m6tly@master> Reply-To: Wei Yang References: <20191128010321.21730-1-richardw.yang@linux.intel.com> <20191128083255.ab5rwj7gvktwunik@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191128083255.ab5rwj7gvktwunik@box.shutemov.name> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 28, 2019 at 11:32:55AM +0300, Kirill A. Shutemov wrote: >On Thu, Nov 28, 2019 at 09:03:20AM +0800, Wei Yang wrote: >> At this point, we are sure page is PageTransHuge, which means >> hpage_nr_pages is HPAGE_PMD_NR. >> >> This is safe to use PMD_SIZE instead of calculating it. >> >> Signed-off-by: Wei Yang >> --- >> mm/page_vma_mapped.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c >> index eff4b4520c8d..76e03650a3ab 100644 >> --- a/mm/page_vma_mapped.c >> +++ b/mm/page_vma_mapped.c >> @@ -223,7 +223,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) >> if (pvmw->address >= pvmw->vma->vm_end || >> pvmw->address >= >> __vma_address(pvmw->page, pvmw->vma) + >> - hpage_nr_pages(pvmw->page) * PAGE_SIZE) >> + PMD_SIZE) >> return not_found(pvmw); >> /* Did we cross page table boundary? */ >> if (pvmw->address % PMD_SIZE == 0) { > >It is dubious cleanup. Maybe page_size(pvmw->page) instead? It will not >break if we ever get PUD THP pages. > Thanks for your comment. I took a look into the code again and found I may miss something. I found we support PUD THP pages, whilc hpage_nr_pages() just return HPAGE_PMD_NR on PageTransHuge. Why this is not possible to return PUD number? Search in the kernel tree, one implementation of PUD_SIZE fault is dev_dax_huge_fault. If page fault happens here, would this if break the loop too early? >-- > Kirill A. Shutemov -- Wei Yang Help you, Help me