Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1290220ybl; Mon, 2 Dec 2019 00:56:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwTf4JoYoWdRYsxBVc6I9HTeq3TWtsceeEVN8YYzWtRI87xwb00UG5ik3R1GssMv1RcLP32 X-Received: by 2002:a17:906:da04:: with SMTP id fi4mr58010585ejb.24.1575276963626; Mon, 02 Dec 2019 00:56:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575276963; cv=none; d=google.com; s=arc-20160816; b=d2XyzEk0SBpjCbBX8S8BcuhucnQAw4iRMYeLYyfnycXo7SmFYCqYs9tphvCgw6hvqf iBOMEz4aGwTI+ItkJDMopADltIHDP41TnGya4nEmw49a996y6oTHg/o6eUf+dBDWuUh3 VgvfNdrve36OZy3tgByWZvo5B8NMPhDTwTS2hVnEBBYu5kx5FgvrIPYZj970HLqJQZD0 HCT38GAiqY3w9XVpvrfXQIUKKzlFZUrK2saFMDPudJ2d61yf3/MY9UjzLUxgAMGtxheL 6p7HliZ5ZKHQj7yQ6YgXaok0Ejnh3K7MNIsxskHHpM2jeyiVHeuNfNVNPV7Da6VCT7Tj +7PQ== 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; bh=yby6lulHcFW0dxrfvFsZbA3/3iuXoOzYOQE4epfm3HE=; b=QJ8kmB/a5as5qJwjzmobuVuuwukkA2lkHwdmh1/q2OWF1+AqiT5fw6OBzFI6pByWU2 dlpdnt69GMxXxYo5DeBmjO/sylB8F0WjLn9hF8RyDQkR0lI1e/hFmKp9GDCVjTzh9CvF MCjpPE7/SvbqQkghgnTv6GlQw73nzaZWk1QtMVtXmR5n63tHQjqhQQfUfBGI50wKyKQQ EgAzNgbPjmfN9Gw2Vzp4+ZhNyymfwZG8ik8V9Q7LtoR6+hzJFbXj8Jjd7Y4DO2JILru2 uiEMMZiqXxt2BkFIFaj1ePErJWL8egSEn1RFdwOcQJPGHm3g5n+jQxU8UCRopZcGazPN Uw7w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o22si20337495ejr.78.2019.12.02.00.55.39; Mon, 02 Dec 2019 00:56:03 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726251AbfLBIyg (ORCPT + 99 others); Mon, 2 Dec 2019 03:54:36 -0500 Received: from mga18.intel.com ([134.134.136.126]:29850 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbfLBIyg (ORCPT ); Mon, 2 Dec 2019 03:54:36 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Dec 2019 00:54:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,268,1571727600"; d="scan'208";a="262153126" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by FMSMGA003.fm.intel.com with ESMTP; 02 Dec 2019 00:54:33 -0800 Date: Mon, 2 Dec 2019 16:54:27 +0800 From: Wei Yang To: "Kirill A. Shutemov" Cc: Wei Yang , 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: <20191202085427.GA6656@richard> Reply-To: Wei Yang References: <20191128010321.21730-1-richardw.yang@linux.intel.com> <20191128083255.ab5rwj7gvktwunik@box.shutemov.name> <20191128212226.sfrhfs5m3q7m6tly@master> <20191202080315.oqtm3q7cyfkl5rma@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191202080315.oqtm3q7cyfkl5rma@box.shutemov.name> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 02, 2019 at 11:03:15AM +0300, Kirill A. Shutemov wrote: >On Thu, Nov 28, 2019 at 09:22:26PM +0000, Wei Yang wrote: >> 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? > >We only support PUD THP for DAX. Means, we don't have struct page for it. > Ok, many background story behind it. Thanks :-) >-- > Kirill A. Shutemov -- Wei Yang Help you, Help me