From patchwork Mon Jan 10 04:23:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12708166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B66FC433F5 for ; Mon, 10 Jan 2022 04:24:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2BCF6B0075; Sun, 9 Jan 2022 23:24:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C271D6B007E; Sun, 9 Jan 2022 23:24:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 791076B0075; Sun, 9 Jan 2022 23:24:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0109.hostedemail.com [216.40.44.109]) by kanga.kvack.org (Postfix) with ESMTP id 5D9C46B0074 for ; Sun, 9 Jan 2022 23:24:20 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 16EC396F0E for ; Mon, 10 Jan 2022 04:24:20 +0000 (UTC) X-FDA: 79013085480.16.68BD8ED Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf09.hostedemail.com (Postfix) with ESMTP id BBA64140008 for ; Mon, 10 Jan 2022 04:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=dlgtKTjkERgxYua7qA7Yoi6vlUOwWisaGlBoko6Kg7w=; b=MdYehaqZTNoBT0pJr/dBzKu0xk rhxJqipWHBLzxGzgjGBSI9ARSQ1RlA4UFGaT5vyh+ZLD3n7X2WtXi/hIBHEVGqogTYY7hy7cYaNbD L5MM96NFsVLNhjaHZpA7rpoJPoiVDLQaQ+clb3yED1pcwzO53aJrART1VpQnwzz3IlH8mHxrQnI4v HCGbkVFR1Hd/dDw/RZ/wB1DfOJHhjE7+qw3/DKruUDpZ+rY+erQhJUTjkB1tFsoQIt9v4WCQiF9mS GSAMnbkin/NrUmK334/OwCMLSJDzanEXMKDv7Mwe92ldpljQ6RNp0MiNFKkdnOmL2uqPkJBfzkTE6 4x4BRuug==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6mE9-0025x6-F5; Mon, 10 Jan 2022 04:24:13 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , John Hubbard , Christoph Hellwig , William Kucharski , linux-kernel@vger.kernel.org, Jason Gunthorpe Subject: [PATCH v2 21/28] gup: Convert gup_hugepte() to use a folio Date: Mon, 10 Jan 2022 04:23:59 +0000 Message-Id: <20220110042406.499429-22-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220110042406.499429-1-willy@infradead.org> References: <20220110042406.499429-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: BBA64140008 X-Stat-Signature: rz4b3g4fqe4u1gja5zpu3ubhxr133e3d Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=MdYehaqZ; dmarc=none; spf=none (imf09.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam02 X-HE-Tag: 1641788659-151015 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: There should be little to no effect from this patch; just removing uses of some old APIs. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Reviewed-by: John Hubbard --- mm/gup.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 27cc097ec05d..250326458df6 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2428,7 +2428,8 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, struct page **pages, int *nr) { unsigned long pte_end; - struct page *head, *page; + struct page *page; + struct folio *folio; pte_t pte; int refs; @@ -2444,21 +2445,20 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, /* hugepages are never "special" */ VM_BUG_ON(!pfn_valid(pte_pfn(pte))); - head = pte_page(pte); - page = nth_page(head, (addr & (sz-1)) >> PAGE_SHIFT); + page = nth_page(pte_page(pte), (addr & (sz - 1)) >> PAGE_SHIFT); refs = record_subpages(page, addr, end, pages + *nr); - head = try_grab_compound_head(head, refs, flags); - if (!head) + folio = try_grab_folio(page, refs, flags); + if (!folio) return 0; if (unlikely(pte_val(pte) != pte_val(*ptep))) { - put_compound_head(head, refs, flags); + gup_put_folio(folio, refs, flags); return 0; } *nr += refs; - SetPageReferenced(head); + folio_set_referenced(folio); return 1; }