From patchwork Fri Apr 29 19:23:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 12832646 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 3D415C433EF for ; Fri, 29 Apr 2022 19:23:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 473F66B0085; Fri, 29 Apr 2022 15:23:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C23CF6B0082; Fri, 29 Apr 2022 15:23:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 403586B0081; Fri, 29 Apr 2022 15:23:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 958CB6B0087 for ; Fri, 29 Apr 2022 15:23:41 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6E1BEB91 for ; Fri, 29 Apr 2022 19:23:41 +0000 (UTC) X-FDA: 79410891042.31.DE8BD98 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id 66B464002F for ; Fri, 29 Apr 2022 19:23:39 +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=CveTGJI0YjF2Yy/R7A6tUzPOEXCYhi5/J1KQ5SFgEWw=; b=uv+Ov3+dLw+Y5MYp6U6Qz7Qugi jmBRfpcagXqD6xRtiW1HvUB6dyUJ5CifRr20h0sCukZ2SL77gAezvHK2vXlKtJS7KZdA2qUKmlcmd 39ARnRr8rBKVDalBlOyoSCh77TdOXiCGSg4vV5eBBfuAVhMciCGH6KyRsmtP+Osbf4YFqBoHUnHmZ pei+wMKrIKzH5deGDE0WC7qBpsrBg/JLZ9QuIxMA1hy784sAQiEAtP08I8Dp4a5aKUMjey9L6ngoh CtlRw0h8TPC8te5SKS/t5688fE7l2uJq5FX83hfa4/vvIsctC0Owd7vqFtAMsfJiQmen1kPbYxCBc nereYmew==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkWDK-00CjPs-Lu; Fri, 29 Apr 2022 19:23:38 +0000 From: "Matthew Wilcox (Oracle)" To: akpm@linuxfoundation.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 17/21] mm/shmem: Turn shmem_should_replace_page into shmem_should_replace_folio Date: Fri, 29 Apr 2022 20:23:25 +0100 Message-Id: <20220429192329.3034378-18-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220429192329.3034378-1-willy@infradead.org> References: <20220429192329.3034378-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 66B464002F X-Stat-Signature: t5zmm7uacqrzm51j9j8ycdqmk5pabutj X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=uv+Ov3+d; spf=none (imf27.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: 1651260219-326650 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: This is a straightforward conversion. Signed-off-by: Matthew Wilcox (Oracle) --- mm/shmem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 4331a4daac01..4b8d0972bf72 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1600,9 +1600,9 @@ static struct page *shmem_alloc_and_acct_page(gfp_t gfp, * NUMA mempolicy, and applied also to anonymous pages in do_swap_page(); * but for now it is a simple matter of zone. */ -static bool shmem_should_replace_page(struct page *page, gfp_t gfp) +static bool shmem_should_replace_folio(struct folio *folio, gfp_t gfp) { - return page_zonenum(page) > gfp_zone(gfp); + return folio_zonenum(folio) > gfp_zone(gfp); } static int shmem_replace_page(struct page **pagep, gfp_t gfp, @@ -1734,13 +1734,13 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index, */ arch_swap_restore(swap, page); - if (shmem_should_replace_page(page, gfp)) { + folio = page_folio(page); + if (shmem_should_replace_folio(folio, gfp)) { error = shmem_replace_page(&page, gfp, info, index); if (error) goto failed; } - folio = page_folio(page); error = shmem_add_to_page_cache(folio, mapping, index, swp_to_radix_entry(swap), gfp, charge_mm);