From patchwork Fri Feb 4 19:57:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12735547 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 0BBA6C433EF for ; Fri, 4 Feb 2022 20:00:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 81CB08D0017; Fri, 4 Feb 2022 14:59:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B4708D0019; Fri, 4 Feb 2022 14:59:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A17B38D0009; Fri, 4 Feb 2022 14:59:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0163.hostedemail.com [216.40.44.163]) by kanga.kvack.org (Postfix) with ESMTP id 24C9F8D0014 for ; Fri, 4 Feb 2022 14:59:10 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D5AF492779 for ; Fri, 4 Feb 2022 19:59:09 +0000 (UTC) X-FDA: 79106161218.14.62FBBA5 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id 8772C20003 for ; Fri, 4 Feb 2022 19:59:09 +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=JubzDfprAA1Un2jOXx0p+mdrOF9Jffo8nBXBBkxLbYU=; b=iPVQs+aC5XUS7bDv6l/us8ZJPC yoKMdOcdnUTcRQccnXiOqXkmUbJAPjIyfQVsmbgEgbv71a2Dy++AKfMAQFWzcqe4yUrL5c9c+fzA4 RcO0epUbpGbz1nSWQtpIZUMhxy/6gnT/Q3yrN7ak0wNt1/7jsEnbccTXAqpS4cmSLPxEEtQcX3WXj b6nhFkQQuX6oYFoa5y9eCojIRLouUlwz1YCknq186/1TBlmIcOn7i/F7tlEre+BsffFhwT3Gulqnh Nd16VCX6tTTuQMZnb7MNHiUmwGdlgohj8lDQbUVLhBRiQGypYNapaRNN1FepCwKeb+OKiX095dUAR S5HLkq8w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nG4jV-007Llt-Er; Fri, 04 Feb 2022 19:59:01 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, Christoph Hellwig , John Hubbard , Jason Gunthorpe , William Kucharski Subject: [PATCH 21/75] mm/gup: Convert gup_hugepte() to use a folio Date: Fri, 4 Feb 2022 19:57:58 +0000 Message-Id: <20220204195852.1751729-22-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220204195852.1751729-1-willy@infradead.org> References: <20220204195852.1751729-1-willy@infradead.org> MIME-Version: 1.0 X-Stat-Signature: 3ttchr46mdcndc3p1js3hpedn8dy95wn X-Rspam-User: nil Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=iPVQs+aC; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 8772C20003 X-HE-Tag: 1644004749-574385 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 Reviewed-by: Jason Gunthorpe Reviewed-by: William Kucharski --- mm/gup.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 44281350db1a..6faf8beb4cd9 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2445,7 +2445,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; @@ -2461,21 +2462,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; }