From patchwork Sun Jan 2 21:57:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12702374 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 DF5A5C433EF for ; Sun, 2 Jan 2022 21:57:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 401A36B0085; Sun, 2 Jan 2022 16:57:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1AFB26B0087; Sun, 2 Jan 2022 16:57:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02F356B0088; Sun, 2 Jan 2022 16:57:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id E0A0C6B0085 for ; Sun, 2 Jan 2022 16:57:55 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A38288249980 for ; Sun, 2 Jan 2022 21:57:55 +0000 (UTC) X-FDA: 78986710110.21.3215A86 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP id 0A00B8000C for ; Sun, 2 Jan 2022 21:57:48 +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=/ULprEWFj6Xtz7N1o//OT1f6GGRgqj0l3CguOhHZiW4=; b=OuvzOjJAIlpiSOXEDbMWMEQbzB RTVCbd169FsGfpj5AdzO4QXT4e6/o8jxb4+ry2k8g2vhcUA0zGKD681sEhn2TsTQ/FJFV+nREbYaG f5jBXQNRbA5KE0ck/dvlugHPTTx1llnnffbw1arhF7XxnoQTt2lHDDJ1NI9SzkVKV7Tho+o5/D3qX YGat7rJLdoVCoPMHyjjpKkt0g91im1gyuQfGO6cu/EUUzO3AOvbmp6d4sX+4kPaxiR3RBvv7CqYkS FpOgJ+AYgKOnacckYvfXbhuNNCcW1m8wom/9zWqhK8ZDoyvzsl1NqR+z5lccCStVjeAxOYXzr6T9V O7fqU3YQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1n48r5-00CLny-Vc; Sun, 02 Jan 2022 21:57:32 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , John Hubbard , Andrew Morton Subject: [PATCH 02/17] mm: Add folio_pincount_available() Date: Sun, 2 Jan 2022 21:57:14 +0000 Message-Id: <20220102215729.2943705-3-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220102215729.2943705-1-willy@infradead.org> References: <20220102215729.2943705-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0A00B8000C X-Stat-Signature: ktnqjnjudmbik41ig7j4wa47h1qhmo71 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=OuvzOjJA; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1641160668-361459 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: Convert hpage_pincount_available() into folio_pincount_available() and turn hpage_pincount_available() into a wrapper. We don't need to check folio_test_large() before checking folio_order() as folio_order() includes a check of folio_test_large(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Reviewed-by: John Hubbard --- include/linux/mm.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 98a10412d581..269b5484d66e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -927,15 +927,19 @@ static inline void destroy_compound_page(struct page *page) compound_page_dtors[page[1].compound_dtor](page); } -static inline bool hpage_pincount_available(struct page *page) +static inline bool folio_pincount_available(struct folio *folio) { /* - * Can the page->hpage_pinned_refcount field be used? That field is in + * Can the folio->hpage_pinned_refcount field be used? That field is in * the 3rd page of the compound page, so the smallest (2-page) compound * pages cannot support it. */ - page = compound_head(page); - return PageCompound(page) && compound_order(page) > 1; + return folio_order(folio) > 1; +} + +static inline bool hpage_pincount_available(struct page *page) +{ + return folio_pincount_available(page_folio(page)); } static inline int head_compound_pincount(struct page *head)