From patchwork Wed Dec 13 21:58:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491934 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 99E44C4332F for ; Wed, 13 Dec 2023 21:59:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD7E28D0068; Wed, 13 Dec 2023 16:59:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D60B98D0062; Wed, 13 Dec 2023 16:59:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8B578D0068; Wed, 13 Dec 2023 16:59:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A9BE88D0062 for ; Wed, 13 Dec 2023 16:59:17 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8AA41120249 for ; Wed, 13 Dec 2023 21:59:17 +0000 (UTC) X-FDA: 81563161554.04.4737575 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf29.hostedemail.com (Postfix) with ESMTP id D7AB9120014 for ; Wed, 13 Dec 2023 21:59:15 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ZmfZlXBF; dmarc=none; spf=none (imf29.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504756; 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=rESDGRh+HGjvAVtWfRknecQJU7RLbVO98sVBBLWl39U=; b=6bRS9z0aNVSGW/7DNN2U76tg3Uln1PLHCVGgO78Wn6QvMpl1N+45StcwYXnH4I0lHMtRUH 0WoTdcyioYe/AiC4XkUTGdAwP6aRg+S4ogBAWaKrzUYcI8bURwJ+Kz9GBqQfJuw6PKvCoj MfZguAtGopAaIDOssp4F3jukMsTfxHE= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ZmfZlXBF; dmarc=none; spf=none (imf29.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504756; a=rsa-sha256; cv=none; b=ICcqL/sKAi4j6V2oWQ6DNlRa6kX0SqjIyyiT1hZneHgNcx8bU08BYiyGrxbC9fLtIvTfX8 RDkuhklb5TfA5TkLh/FiYqxV4T6nzg/bZEGURwLOok9hYiVkJSmDSTR+d6+VzmRu5X1BZS xkJlMbMmsQ2DCjx5FLrHUbQcpzsK1cs= 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=rESDGRh+HGjvAVtWfRknecQJU7RLbVO98sVBBLWl39U=; b=ZmfZlXBFk68fx457s8jFnfIKT5 4SxXTBi9vHoLB9LYUDI9V3WDpirQhkII8p8hlbKpXGUlflH/F7cb4PuBzldiIYkRcozobUkWVlwdj CZMCFHQYupeIvoJLX3M1gnHJfMS/WgUFJ3tkKqc15+EaThQirB2uJq6UfkmqTq1swWbPLdpdxyvVd MSlEEe4tbmyDPOVYCK/Qp6WXuEdbY2PwSiQyZajXGoud9J4qmwSmpvqdybmRbQXeZjiCmFkZmx591 5ld4SfUAwRLTQU9CNYiGlRo4YVgQhzWldhs/S/9p49A1dwyNqtsas2Assb3UW1qgIePX0ySwdAOrr XFbXtJeQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiL-AU; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 02/13] mm: Pass a folio to __swap_writepage() Date: Wed, 13 Dec 2023 21:58:31 +0000 Message-Id: <20231213215842.671461-3-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D7AB9120014 X-Stat-Signature: 73t9swwsx513ifbj7p5staci1fxyejwm X-HE-Tag: 1702504755-301479 X-HE-Meta: U2FsdGVkX19svnD3sD73XkJ4zF8NMXZmRjgDQvNAyHlICnxSSOvpjd3E+o9TqQyXKU3qQqC4DJuQw/PdqS6Iss3Ds1f9cnzRNCAtFbwEzQUAf5K0l9fOJfcTWhu9RsU4glqqTycON7boxfxdJX5SmMCUqy8m41/az6M6dtmpe1P6lNU2furBvBLXYgig0VOORtUhWaqZVuYt6DfEFgVGGIlVqa2cEmEP9cnVfCFCBr6ES7VtuLn2K1v72wTgWWmoEq39vsNO5YqPzu6EVclpCCYlbaBB3q44Vov0jAqgIheVJfbD+k5CzyRB1xtbMPDqID4+c497v1xealzd1+MlqChLV41lijlN6aofTuzNwoUf/2dsMDsy3GWxBAR1/ZDyKmSaf1KYkIsPmI5j8BUHxBGofRv+MPoqR921PmxE6jbrBKtelRSWO3bfDhNtXV58mGU62ztDyCA/pzcmL98ajr3Qls/Il3vjDy1WaDkQl0y7iwSPk0XPcSEKdgkYebALFVPG0zQm12Jp/5NQZudMdS5/CnijvArlDtfMNfNqNmItEU+cirFkinPrOPazORCtYoFsGdugiGPkXZLCCCpbjoe+QZjVjSH4c7F6xuJyJMjM/hSS6XdCHPtlKC/W+8ejJNGp01pVk79qpqtGsYVN5OAHGjcK8eTmFuSavX69p8c4L0ZkYYXYkuC8hgg5Lr6Gu+QpVi+257JFRwLbNdtJOANsMotQCGeS2gXnBAI3/hDY+Krg15fgzAVuUDDETKVXRXE8MZ6vaR4zL50oPej81Xzs7lTxI71fs0oHfkd3D0uGQA+jirkX/4CRUH0kwOpBQoU8qhi7E/AcitZ8haxAJH9RXWDmcsB1rbQfJmEhy1yZBdUZrt0J4sSxCBvIIUWzyRTlMUqRsoEZdt7jCKvodOQnedfAdKo9eDVAjmYbt+bCLqW3c5J2z3Jsu/bd4em7B7s1DckEK5vlQ5gEsnx 8d9WPiY8 ZkaHo8eZTjWNw9HGOJ0bNVLKNQ2momgQEMOB54VcV3567u41ksMDtHYle5Ctx+AkHhBSQoUgIMK7NCiEpbgweg8eta6C8I8Pw2Lr+3sF+kJ3tZWc19EJHK8q09Z6Ox1voTsg1N2b3AgcO/W3NDjV36v6mMZqlmu7/sSp1ZWwjdAovQ8EBbBxP8xpbBc+jB/qxigBHW2FTq8bXPOM8qKBJoxg+9tOGRRICeogG 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: List-Subscribe: List-Unsubscribe: Both callers now have a folio, so pass that in instead of the page. Removes a few hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 14 +++++++------- mm/swap.h | 2 +- mm/zswap.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index cb559ae324c6..e0d59f36b70b 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -201,7 +201,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) folio_end_writeback(folio); return 0; } - __swap_writepage(&folio->page, wbc); + __swap_writepage(folio, wbc); return 0; } @@ -368,22 +368,22 @@ static void swap_writepage_bdev_async(struct page *page, submit_bio(bio); } -void __swap_writepage(struct page *page, struct writeback_control *wbc) +void __swap_writepage(struct folio *folio, struct writeback_control *wbc) { - struct swap_info_struct *sis = page_swap_info(page); + struct swap_info_struct *sis = swp_swap_info(folio->swap); - VM_BUG_ON_PAGE(!PageSwapCache(page), page); + VM_BUG_ON_FOLIO(!folio_test_swapcache(folio), folio); /* * ->flags can be updated non-atomicially (scan_swap_map_slots), * but that will never affect SWP_FS_OPS, so the data_race * is safe. */ if (data_race(sis->flags & SWP_FS_OPS)) - swap_writepage_fs(page, wbc); + swap_writepage_fs(&folio->page, wbc); else if (sis->flags & SWP_SYNCHRONOUS_IO) - swap_writepage_bdev_sync(page, wbc, sis); + swap_writepage_bdev_sync(&folio->page, wbc, sis); else - swap_writepage_bdev_async(page, wbc, sis); + swap_writepage_bdev_async(&folio->page, wbc, sis); } void swap_write_unplug(struct swap_iocb *sio) diff --git a/mm/swap.h b/mm/swap.h index a60ab1cfcaf2..b81587740cf1 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -19,7 +19,7 @@ static inline void swap_read_unplug(struct swap_iocb *plug) } void swap_write_unplug(struct swap_iocb *sio); int swap_writepage(struct page *page, struct writeback_control *wbc); -void __swap_writepage(struct page *page, struct writeback_control *wbc); +void __swap_writepage(struct folio *folio, struct writeback_control *wbc); /* linux/mm/swap_state.c */ /* One swap address space for each 64M swap space */ diff --git a/mm/zswap.c b/mm/zswap.c index 08b5212aa6b8..0aa3b434d9b5 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1485,7 +1485,7 @@ static int zswap_writeback_entry(struct zswap_entry *entry, } /* start writeback */ - __swap_writepage(&folio->page, &wbc); + __swap_writepage(folio, &wbc); folio_put(folio); return ret;