From patchwork Thu Jan 9 06:44:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Xinhai X-Patchwork-Id: 11325099 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 529011580 for ; Thu, 9 Jan 2020 06:46:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 13A3D2072E for ; Thu, 9 Jan 2020 06:46:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LnjJ2X1k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13A3D2072E 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 11AE68E0005; Thu, 9 Jan 2020 01:46:30 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0CB148E0001; Thu, 9 Jan 2020 01:46:30 -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 EFC388E0005; Thu, 9 Jan 2020 01:46:29 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id DA7098E0001 for ; Thu, 9 Jan 2020 01:46:29 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 57E3D3A91 for ; Thu, 9 Jan 2020 06:46:29 +0000 (UTC) X-FDA: 76357162098.11.son73_389a76117bb62 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: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.128.67:@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: son73_389a76117bb62 X-Filterd-Recvd-Size: 3554 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Jan 2020 06:46:28 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id d139so1300148wmd.0 for ; Wed, 08 Jan 2020 22:46:28 -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; bh=swU1zHzw4d3VFEhpvmJqxtU8eeR4ifXvJjtrhtpzw2s=; b=LnjJ2X1kqLkSvBkea/kxA56EMf3Gf2ibeFsJlbHKIyo+MIC12u5pWEY9+14Yf+GYRx iwo7A+RwF3JE/l10QLfAMVl5hT0hV8Mr6D5OqBBwkdnHCBfUlw/5shGP1qBX0sJV99b8 izaeHYCvCH05/l+pVwRLQNp33fnHjDmuV7lcEzYy/5FGqKp+3dkRdl4sSWb8yvBkbbK1 Jljr9cvYCcRW8mu/qIwthqm5eEHEk5kYc5zzCUql3xuvYRjzR/apOP6e2VIqka8b91rC TeaYVtjZfN4bbdq5sB9t1Sz1JX0+H+iCh9ct/PkLyQeDHmtrFb5hWzglWxmACV3xOZUs kMFg== 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; bh=swU1zHzw4d3VFEhpvmJqxtU8eeR4ifXvJjtrhtpzw2s=; b=esGbvvqWkDuCNsFvRy8zTi3ylndK7e4RuDuo3e4vI7Of466ZsrzYhFJy/sZ8j54Oez +juhOAFpn87Hze5spaEWESFm/q5pFf/S0YVtPnO9SZoB4DZJ+yPQrwj6tWsQ7CYPgIGb MrXu6h9TQJ1GTShmJ/dqZW6Ltt6OxFpraA/bYbeetOZSp3FwGHeeF8unt2kvIslwKvl4 QyjRltmrkvzjsn25gawZUsHpBRXtI4bwdzTnJl4uGHFnFCexTsybtmZ6vdv74DzVNE9m o8PGlTX6fi/thVW5aEWSXEXgGM8qprsXT8Ucffw9cAtIrkM+OaWcB4PB9nm45kpem03z JtXg== X-Gm-Message-State: APjAAAUI26fdrEkncQ8cN1qaloxe/2r7aOXWMAK3+F9E2k1r1jM1GQ7e 09XcNrzKYeklLxVu0t1HqhEe/dJ3 X-Google-Smtp-Source: APXvYqxa+xYC0MzisbSrlz9ZTxmElcF0LPzvbh6HKuhoP3kDqbdbJXgI9lAl6XAD/UStuo6zyWjzug== X-Received: by 2002:a1c:cc06:: with SMTP id h6mr2639174wmb.118.1578552387413; Wed, 08 Jan 2020 22:46:27 -0800 (PST) Received: from localhost.localdomain.localdomain ([131.228.2.20]) by smtp.gmail.com with ESMTPSA id b67sm1814532wmc.38.2020.01.08.22.46.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jan 2020 22:46:26 -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 06:44:40 +0000 Message-Id: <1578552280-5703-1-git-send-email-lixinhai.lxh@gmail.com> X-Mailer: git-send-email 1.8.3.1 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);