From patchwork Thu Jan 9 14:26:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Xinhai X-Patchwork-Id: 11325837 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B1D818B8 for ; Thu, 9 Jan 2020 14:27:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EC86820673 for ; Thu, 9 Jan 2020 14:27:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nG0mwhTB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC86820673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 342A98E0015; Thu, 9 Jan 2020 09:27:55 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2CDD68E0001; Thu, 9 Jan 2020 09:27:55 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A99E8E0015; Thu, 9 Jan 2020 09:27:55 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E9F1F8E0001 for ; Thu, 9 Jan 2020 09:27:54 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id A59F4181AC9BF for ; Thu, 9 Jan 2020 14:27:54 +0000 (UTC) X-FDA: 76358324868.29.form47_aca053eb1930 X-Spam-Summary: 2,0,0,5311811d6619bf2b,d41d8cd98f00b204,lixinhai.lxh@gmail.com,::kirill.shutemov@linux.intel.com,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1534:1540:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3867:3868:3870:3871:3872:5007:6119:6120:6261:6653:7514:7875:7901:7903:8957:9413:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:13069:13153:13228:13255:13311:13357:14096:14181:14384:14394:14687:14721:21080:21444:21451:21627:21666:21990:30054:30070,0,RBL:209.85.208.196:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: form47_aca053eb1930 X-Filterd-Recvd-Size: 3756 Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Jan 2020 14:27:53 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id u1so7446645ljk.7 for ; Thu, 09 Jan 2020 06:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=swU1zHzw4d3VFEhpvmJqxtU8eeR4ifXvJjtrhtpzw2s=; b=nG0mwhTB3Z3wDVcZsF+MrfDTIDtvr5ynPPyb1nifgdMNIG8z7ta0ardV3R2cJwDK7y 9nP1A9mAveMkFmAs3X3VwlBTM7gysHyhrzPDO3dv3VWS3NddxfH6b4tdn2bM+UmW2UDK uEesDwmj4NQNFNlIJ+YAqlGQ3C4DRLz1Am02sDnUCppi6XYoYM1oys4NRJ0ILKk+7AIf IEafXsCU38J0FBNLJxsRqXKZ6D5m6AesTv+yU4WF6ORqxpuswnMtct1FFKCw5dF+naKE ACyCUmbwVZ3Lrdo6vjyCiXiboqM3VRxJmQYgqgUPfhP+9EpOMxLF8N4gPaRJkSZwwQBH LRSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=swU1zHzw4d3VFEhpvmJqxtU8eeR4ifXvJjtrhtpzw2s=; b=VAKRYfviCdFdLCgbX7NdVmPeoLfXz5J/Qb56l9ry8w1AKglyPhHyBBeuVKbxXCcnkQ Cm6pxLkIIep38L70PNIHH5LVnRPudcsbAQCt3yfb49xm+lwzp1Nd9laRvy++mW8VzcrF E53nt/YofJ8zJPFn8z5xV0uE+VbROk+2EfnP2Wedzw3YsobhmPy/2EecuFg6+NW18KxQ JPJZlOgi6Bx+reJsgHT3OCcfu3+dI2pYMJ+9wj++h2kUAU2zG7bQIo+ktG06E6qrVEu+ VOhEPrfaJGZjLFbxgz2y6QlSvAP0RywBZQU1Ksb0Fk5WsAZPVxHrYPfgt6gy4R12OLhN kkUA== X-Gm-Message-State: APjAAAVljWJ0+m2kAiFX1klbwxev/FtQuiwIWflhjZFI/HB/C12p3qFt yraSOj7zgeXK50ImwqICJ4dKJn3y X-Google-Smtp-Source: APXvYqxIAXFlKKMhu95BxoZyFG0c3LULZ6R9Qva0TXJktWVaDk64b0pL5GYBpY7bRRu1GtcHOdCuLA== X-Received: by 2002:a2e:8eda:: with SMTP id e26mr6498467ljl.65.1578580072600; Thu, 09 Jan 2020 06:27:52 -0800 (PST) Received: from localhost.localdomain.localdomain ([131.228.2.21]) by smtp.gmail.com with ESMTPSA id q17sm3110732ljg.23.2020.01.09.06.27.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jan 2020 06:27:52 -0800 (PST) From: Li Xinhai To: linux-mm@kvack.org Cc: "Kirill A. Shutemov" Subject: [PATCH] mm/page_vma_mapped.c: Exactly compare hugetlbfs page's pfn in pfn_in_hpage() Date: Thu, 9 Jan 2020 14:26:03 +0000 Message-Id: <1578579963-6075-2-git-send-email-lixinhai.lxh@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1578579963-6075-1-git-send-email-lixinhai.lxh@gmail.com> References: <1578579963-6075-1-git-send-email-lixinhai.lxh@gmail.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: check_pte is called for hugetlbfs page and comparing pfn in pfn_in_page, where pfn is compared in range [hpage_pfn, hpage_pfn+HPAGE_PMD_NR). Now change it to match exactly for hugetlbfs page to avoid hiding any potential problems. Signed-off-by: Li Xinhai Cc: Kirill A. Shutemov --- mm/page_vma_mapped.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c index eff4b45..434978b 100644 --- a/mm/page_vma_mapped.c +++ b/mm/page_vma_mapped.c @@ -55,6 +55,8 @@ static bool map_pte(struct page_vma_mapped_walk *pvmw) static inline bool pfn_in_hpage(struct page *hpage, unsigned long pfn) { unsigned long hpage_pfn = page_to_pfn(hpage); + if (unlikely(PageHuge(hpage))) + return pfn == hpage_pfn; /* THP can be referenced by any subpage */ return pfn >= hpage_pfn && pfn - hpage_pfn < hpage_nr_pages(hpage);