From patchwork Mon Aug 8 19:34:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12939096 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 0C848C00140 for ; Mon, 8 Aug 2022 19:36:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 98CC38E0002; Mon, 8 Aug 2022 15:36:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9151A8E0001; Mon, 8 Aug 2022 15:36:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78E7E8E0002; Mon, 8 Aug 2022 15:36:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 6568F8E0001 for ; Mon, 8 Aug 2022 15:36:25 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 46833160168 for ; Mon, 8 Aug 2022 19:36:25 +0000 (UTC) X-FDA: 79777431930.17.39F0EE8 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf22.hostedemail.com (Postfix) with ESMTP id EE599C012E for ; Mon, 8 Aug 2022 19:36:24 +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=M1IcjVrPwbJ90c9OBDp6bP2D6HcUQ3yjRyZFQBHUAWE=; b=sQI6ByvPmhKRinNlyzulNxry+l c3bh5HiQz5RtvNVqidf3bK2no331JgaQuN/jRuWxI9Kd3JK48/AzvK6p9f2RumRUtS7bOuzAIVJdC x1adtKAJNoXjaisFQHzFuWnQQKZIKkZklbGrYdavwh26SieC8oYMovjp1J3QcJZknPI2eDPzPiKHv d96/yy6TRKHzvTvMFJxflTpakV+Zcbq8ZfZ1ExnoW2DxnnQrB/BbFU5vJFfTFHhedoA0YU6uBrFGS Eeh7uMOOPHbxMV82/zLXG68oItvf8wb1EaOpod2amP5JyotIKkcVD68jAel/GYBtkvT1HlbDgYf8v A812j10g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL8XW-00EB3P-8l; Mon, 08 Aug 2022 19:35:53 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , hughd@google.com Subject: [PATCH 56/59] huge_memory: Convert unmap_page() to unmap_folio() Date: Mon, 8 Aug 2022 20:34:24 +0100 Message-Id: <20220808193430.3378317-57-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220808193430.3378317-1-willy@infradead.org> References: <20220808193430.3378317-1-willy@infradead.org> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659987385; a=rsa-sha256; cv=none; b=dkB2NTNNaWWcCmhsDib7Fq5eQLGoxTXNCQD6oUytfm/vkH94ZMD/2ghVcNpdmRqaFx7hvQ kBn4Y7hLKac9lwjxphEknBxivgIWyWmuP+POF1q4wOpvXkLskQEakp9HqoNkwvU31b/7dV 0xM48aoK14enHajyZKpNfJcTfvO1I8M= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=sQI6ByvP; spf=none (imf22.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659987385; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=M1IcjVrPwbJ90c9OBDp6bP2D6HcUQ3yjRyZFQBHUAWE=; b=ONseVrAF6uRhXVE5f3ovN2R0ni/lv4T6wcB9khQBgbHxxFw4C5Kq5EmNw/eW9eJd3yqgoO KzLYif300kiUAvsufnNXB1FNo/YM5suVM/drg4tmXm2BODIRHiNWZSmZg9RBifVws7/t8j yeVzhuTKrVwlR37LkWKsE/bimLYPxzQ= X-Rspamd-Server: rspam06 X-Rspam-User: X-Stat-Signature: 5zxnmrfmr5ax9jw1cm7mwztwigq6d8fs X-Rspamd-Queue-Id: EE599C012E Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=sQI6ByvP; spf=none (imf22.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: 1659987384-743539 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: Remove a folio->page->folio conversion. Signed-off-by: Matthew Wilcox (Oracle) --- mm/huge_memory.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 431a3b7078c7..2b0f8787c7ed 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2326,13 +2326,12 @@ void vma_adjust_trans_huge(struct vm_area_struct *vma, } } -static void unmap_page(struct page *page) +static void unmap_folio(struct folio *folio) { - struct folio *folio = page_folio(page); enum ttu_flags ttu_flags = TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD | TTU_SYNC; - VM_BUG_ON_PAGE(!PageHead(page), page); + VM_BUG_ON_FOLIO(!folio_test_large(folio), folio); /* * Anon pages need migration entries to preserve them, but file @@ -2349,7 +2348,7 @@ static void remap_page(struct folio *folio, unsigned long nr) { int i = 0; - /* If unmap_page() uses try_to_migrate() on file, remove this check */ + /* If unmap_folio() uses try_to_migrate() on file, remove this check */ if (!folio_test_anon(folio)) return; for (;;) { @@ -2399,7 +2398,7 @@ static void __split_huge_page_tail(struct page *head, int tail, * for example lock_page() which set PG_waiters. * * Note that for mapped sub-pages of an anonymous THP, - * PG_anon_exclusive has been cleared in unmap_page() and is stored in + * PG_anon_exclusive has been cleared in unmap_folio() and is stored in * the migration entry instead from where remap_page() will restore it. * We can still have PG_anon_exclusive set on effectively unmapped and * unreferenced sub-pages of an anonymous THP: we can simply drop @@ -2660,7 +2659,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) } /* - * Racy check if we can split the page, before unmap_page() will + * Racy check if we can split the page, before unmap_folio() will * split PMDs */ if (!can_split_folio(folio, &extra_pins)) { @@ -2668,7 +2667,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) goto out_unlock; } - unmap_page(&folio->page); + unmap_folio(folio); /* block interrupt reentry in xa_lock and spinlock */ local_irq_disable();