From patchwork Mon Jan 10 04:24:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12708191 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 3744AC433FE for ; Mon, 10 Jan 2022 04:25:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0AD2B6B00AE; Sun, 9 Jan 2022 23:24:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F0C816B00B3; Sun, 9 Jan 2022 23:24:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CC656B00B2; Sun, 9 Jan 2022 23:24:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id E843F6B00AE for ; Sun, 9 Jan 2022 23:24:47 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9BE91181C49D9 for ; Mon, 10 Jan 2022 04:24:47 +0000 (UTC) X-FDA: 79013086614.07.1F7C73F Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf31.hostedemail.com (Postfix) with ESMTP id 4E1BC20004 for ; Mon, 10 Jan 2022 04:24:47 +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=Tv81wfblYI2u4OnQaOMT5hu8NAr/0b4Pr52a1X1WL0g=; b=diks2I8M9hwZoO5nHFOXQp5WyE eA0oBnejOYqo+gENL+UsfMVy2fpxjWcrb7cx8F1VccqE0JvMXMYxPIwO1yv1SwfSxeISuecUznhZ7 bAIhQh40BWNiigAhbgDK/3iP4kW1Lnu4yIh/wLpKya93/tiE/PYCK52JWgDPxwa5XkP+PYAQL7W0m hLYS7ATN46P4pWbEIuy8Rm5w77AT4mexrKdF3SaxgC0ebQqzikpT8VZrNc77UhRWc0OZNbNp/Rqif D3rJTMFywPuaEVUm8fKfWuQftRHYCeN6D0Hg7QNvMqMprECBqONl3IDrBpubXzBu0TXHe840r9AYj F5VLmCtQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6mE9-0025x8-HW; 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 22/28] gup: Convert gup_huge_pmd() to use a folio Date: Mon, 10 Jan 2022 04:24:00 +0000 Message-Id: <20220110042406.499429-23-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-Server: rspam08 X-Rspamd-Queue-Id: 4E1BC20004 X-Stat-Signature: duijhnbc1bg3hjwfnjrbdxwfsss3kgdb Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=diks2I8M; spf=none (imf31.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-HE-Tag: 1641788687-516450 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: Use the new folio-based APIs. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Reviewed-by: John Hubbard --- mm/gup.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 250326458df6..a006bce2d47b 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2492,7 +2492,8 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, unsigned long end, unsigned int flags, struct page **pages, int *nr) { - struct page *head, *page; + struct page *page; + struct folio *folio; int refs; if (!pmd_access_permitted(orig, flags & FOLL_WRITE)) @@ -2508,17 +2509,17 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, page = nth_page(pmd_page(orig), (addr & ~PMD_MASK) >> PAGE_SHIFT); refs = record_subpages(page, addr, end, pages + *nr); - head = try_grab_compound_head(pmd_page(orig), refs, flags); - if (!head) + folio = try_grab_folio(page, refs, flags); + if (!folio) return 0; if (unlikely(pmd_val(orig) != pmd_val(*pmdp))) { - put_compound_head(head, refs, flags); + gup_put_folio(folio, refs, flags); return 0; } *nr += refs; - SetPageReferenced(head); + folio_set_referenced(folio); return 1; }