From nobody Fri Jun 12 21:29:43 2026 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B74C348883 for ; Tue, 12 May 2026 10:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582540; cv=none; b=cV/1zZjQ3iUhL681yX0AJ3WxMTtYqSu6OsmPRtyJzSo4lyrlFQ2HcMMQHEKavkATdCrjx3WnLVudV1raa0GQJRFWWzIIjkAkkvjFAQ0gwsh/BatvPV4upiOnUK1jQim8ciexos4TfnQ+9vP1OhQrfPAZr4JlcTKInI0l7l9NRUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582540; c=relaxed/simple; bh=7oepdnD50kdIriHDYKh/8zJrzhblpPz2QiRfBH36jDw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=Xf4Byy8GENzPeh5W/83gWrihcBfDEkWZZS+vZs8avJZKXrDgb87c7i2k6LJzAEoMxpArLQBU1NYFlXjiQ4dkImjpY6spdlD9PlEK05v0RVXW7WCL70hCB+Sv264VTDLDzRO4o2+aSd2rdAsimFAd0SRdFkV9Zgv3YsHWZbbLMYc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=T/ghAxl2; arc=none smtp.client-ip=95.215.58.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="T/ghAxl2" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1778582536; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m3lf2RIQBzCBN9+5LnXZu2FjSHtByyMOG2IjSa32/uY=; b=T/ghAxl26IJ5Y9Hz6rktTE7EgP0sqc7106o5MYtSEX/93cpAaaQcyUulVTHR49tgz4S0ze grNbQQnWIPc2hNNckZ2pUz/R9Ac2tCWbqP9Sr70cnsv8u/SVkLDpiESeUcO4tpEVjYq11F RL9YkUdGDcIxMo9DrrZ8kHM89FWArSk= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, chrisl@kernel.org, usama.arif@linux.dev, baohua@kernel.org, kasong@tencent.com, nphamcs@gmail.com, shikemeng@huaweicloud.com, youngjun.park@lge.com, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH v6 1/3] mm/swap: rename mm/page_io.c to mm/swap_io.c Date: Tue, 12 May 2026 18:41:59 +0800 Message-ID: <20260512104201.716213-2-baoquan.he@linux.dev> In-Reply-To: <20260512104201.716213-1-baoquan.he@linux.dev> References: <20260512104201.716213-1-baoquan.he@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Codes in mm/page_io.c are only related to swap io, it has nothing to do with other page io. Rename it to avoid confusion. Reviewed-by: Nhat Pham Reviewed-by: Barry Song Acked-by: Kairui Song Signed-off-by: Baoquan He Acked-by: Chris Li --- MAINTAINERS | 2 +- mm/Makefile | 2 +- mm/swap.h | 2 +- mm/{page_io.c =3D> swap_io.c} | 2 -- 4 files changed, 3 insertions(+), 5 deletions(-) rename mm/{page_io.c =3D> swap_io.c} (99%) diff --git a/MAINTAINERS b/MAINTAINERS index 98d0a7a1c689..b7746b359471 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17033,7 +17033,7 @@ F: Documentation/mm/swap-table.rst F: include/linux/swap.h F: include/linux/swapfile.h F: include/linux/swapops.h -F: mm/page_io.c +F: mm/swap_io.c F: mm/swap.c F: mm/swap.h F: mm/swap_table.h diff --git a/mm/Makefile b/mm/Makefile index 8ad2ab08244e..a65ac900096a 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -75,7 +75,7 @@ ifdef CONFIG_MMU obj-$(CONFIG_ADVISE_SYSCALLS) +=3D madvise.o endif =20 -obj-$(CONFIG_SWAP) +=3D page_io.o swap_state.o swapfile.o +obj-$(CONFIG_SWAP) +=3D swap_io.o swap_state.o swapfile.o obj-$(CONFIG_ZSWAP) +=3D zswap.o obj-$(CONFIG_HAS_DMA) +=3D dmapool.o obj-$(CONFIG_HUGETLBFS) +=3D hugetlb.o hugetlb_sysfs.o hugetlb_sysctl.o diff --git a/mm/swap.h b/mm/swap.h index a77016f2423b..161185057993 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -214,7 +214,7 @@ extern void __swap_cluster_free_entries(struct swap_inf= o_struct *si, struct swap_cluster_info *ci, unsigned int ci_off, unsigned int nr_pages); =20 -/* linux/mm/page_io.c */ +/* linux/mm/swap_io.c */ int sio_pool_init(void); struct swap_iocb; void swap_read_folio(struct folio *folio, struct swap_iocb **plug); diff --git a/mm/page_io.c b/mm/swap_io.c similarity index 99% rename from mm/page_io.c rename to mm/swap_io.c index 7ed76592e20d..7c1a3a3a53f8 100644 --- a/mm/page_io.c +++ b/mm/swap_io.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 /* - * linux/mm/page_io.c - * * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds * * Swap reorganised 29.12.95,=20 --=20 2.52.0 From nobody Fri Jun 12 21:29:43 2026 Received: from out-179.mta1.migadu.com (out-179.mta1.migadu.com [95.215.58.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DACD8395ADA for ; Tue, 12 May 2026 10:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582547; cv=none; b=NFwWN8iiYcR0CLasPIVh4t4o5rGICSYz+7dIDvf8EgR3MVbJeIKg+jaE/y9lS9FxNfuBhtU1rnBTGXlHNXdm/UNduONmjI+i/3wbBajzaEPO6Z0kpHyGz3maofOLkbVihaRAT7GNYFEUip5e3PahzcJ5vJ6mWVLiBE3Nw5Q1x94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582547; c=relaxed/simple; bh=3b2G+hUn3ElMiK3yKEXXB945NAS0d+2r1GCNipGmzhs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=i795x1GQ15BSRyjNG++fEYm+nllzEPoNvECFcDf7ZB0ZmcjTAihtDe9n85306Gu6106hV4BfnOEmaP4xUrwWLeDhl24dKg1K4xQ1jgGyCgEIIsKJoZbKJig9dVzXFmzXtgi9UmkTh0r837BqhF170ClREYjfMTynjB8Um4BfxkY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=f5eBltfk; arc=none smtp.client-ip=95.215.58.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="f5eBltfk" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1778582544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e2j1qUAZVyouu0JkJWti5wQaqLNp7X4s2VzEYi23lW8=; b=f5eBltfkS8d+d9iJtUvnk6re1hfqHc6W/UuKelt5rv8HK9dvTTKHxU07Bqizvs+bVNussc 5jbkgNmGmHGIeH34gWCoRTNfP9F1lgB4dVBni5ZHk6CW6u1+14yOScG7x4ylSb78CEby+3 wwfGjIU0BC1aYK00DJ1IBUqj6O51WAg= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, chrisl@kernel.org, usama.arif@linux.dev, baohua@kernel.org, kasong@tencent.com, nphamcs@gmail.com, shikemeng@huaweicloud.com, youngjun.park@lge.com, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH v6 2/3] mm/swap: use swap_ops to register swap device's methods Date: Tue, 12 May 2026 18:42:00 +0800 Message-ID: <20260512104201.716213-3-baoquan.he@linux.dev> In-Reply-To: <20260512104201.716213-1-baoquan.he@linux.dev> References: <20260512104201.716213-1-baoquan.he@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" This simplifies codes and makes logic clearer. And also makes later any new swap device type being added easier to handle. Currently there are three types of swap devices: bdev_fs, bdev_sync and bdev_async, and only operations read_folio and write_folio are included. In the future, there could be more swap device types added and more appropriate opeations adapted into swap_ops. Suggested-by: Chris Li Acked-by: Chris Li Co-developed-by: Barry Song Signed-off-by: Barry Song Signed-off-by: Baoquan He --- include/linux/swap.h | 2 + mm/swap.h | 10 ++++- mm/swap_io.c | 102 +++++++++++++++++++++++++------------------ mm/swapfile.c | 9 ++++ mm/zswap.c | 2 +- 5 files changed, 80 insertions(+), 45 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index aa89e1d30a77..85f15ec326c1 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -243,6 +243,7 @@ struct swap_sequential_cluster { unsigned int next[SWAP_NR_ORDERS]; /* Likely next allocation offset */ }; =20 +struct swap_ops; /* * The in-memory structure used to track swap areas. */ @@ -283,6 +284,7 @@ struct swap_info_struct { struct work_struct reclaim_work; /* reclaim worker */ struct list_head discard_clusters; /* discard clusters list */ struct plist_node avail_list; /* entry in swap_avail_head */ + const struct swap_ops *ops; }; =20 static inline swp_entry_t page_swap_entry(struct page *page) diff --git a/mm/swap.h b/mm/swap.h index 161185057993..29bdc679fa98 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -217,6 +217,15 @@ extern void __swap_cluster_free_entries(struct swap_in= fo_struct *si, /* linux/mm/swap_io.c */ int sio_pool_init(void); struct swap_iocb; +struct swap_ops { + void (*read_folio)(struct swap_info_struct *sis, + struct folio *folio, + struct swap_iocb **plug); + void (*write_folio)(struct swap_info_struct *sis, + struct folio *folio, + struct swap_iocb **plug); +}; +int init_swap_ops(struct swap_info_struct *sis); void swap_read_folio(struct folio *folio, struct swap_iocb **plug); void __swap_read_unplug(struct swap_iocb *plug); static inline void swap_read_unplug(struct swap_iocb *plug) @@ -226,7 +235,6 @@ static inline void swap_read_unplug(struct swap_iocb *p= lug) } void swap_write_unplug(struct swap_iocb *sio); int swap_writeout(struct folio *folio, struct swap_iocb **swap_plug); -void __swap_writepage(struct folio *folio, struct swap_iocb **swap_plug); =20 /* linux/mm/swap_state.c */ extern struct address_space swap_space __read_mostly; diff --git a/mm/swap_io.c b/mm/swap_io.c index 7c1a3a3a53f8..3f9aee5b6a4d 100644 --- a/mm/swap_io.c +++ b/mm/swap_io.c @@ -238,6 +238,7 @@ static void swap_zeromap_folio_clear(struct folio *foli= o) int swap_writeout(struct folio *folio, struct swap_iocb **swap_plug) { int ret =3D 0; + struct swap_info_struct *sis =3D __swap_entry_to_info(folio->swap); =20 if (folio_free_swap(folio)) goto out_unlock; @@ -283,7 +284,7 @@ int swap_writeout(struct folio *folio, struct swap_iocb= **swap_plug) } rcu_read_unlock(); =20 - __swap_writepage(folio, swap_plug); + sis->ops->write_folio(sis, folio, swap_plug); return 0; out_unlock: folio_unlock(folio); @@ -373,10 +374,11 @@ static void sio_write_complete(struct kiocb *iocb, lo= ng ret) mempool_free(sio, sio_pool); } =20 -static void swap_writepage_fs(struct folio *folio, struct swap_iocb **swap= _plug) +static void swap_writepage_fs(struct swap_info_struct *sis, + struct folio *folio, + struct swap_iocb **swap_plug) { struct swap_iocb *sio =3D swap_plug ? *swap_plug : NULL; - struct swap_info_struct *sis =3D __swap_entry_to_info(folio->swap); struct file *swap_file =3D sis->swap_file; loff_t pos =3D swap_dev_pos(folio->swap); =20 @@ -409,8 +411,9 @@ static void swap_writepage_fs(struct folio *folio, stru= ct swap_iocb **swap_plug) *swap_plug =3D sio; } =20 -static void swap_writepage_bdev_sync(struct folio *folio, - struct swap_info_struct *sis) +static void swap_writepage_bdev_sync(struct swap_info_struct *sis, + struct folio *folio, + struct swap_iocb **plug) { struct bio_vec bv; struct bio bio; @@ -429,8 +432,9 @@ static void swap_writepage_bdev_sync(struct folio *foli= o, __end_swap_bio_write(&bio); } =20 -static void swap_writepage_bdev_async(struct folio *folio, - struct swap_info_struct *sis) +static void swap_writepage_bdev_async(struct swap_info_struct *sis, + struct folio *folio, + struct swap_iocb **plug) { struct bio *bio; =20 @@ -446,29 +450,6 @@ static void swap_writepage_bdev_async(struct folio *fo= lio, submit_bio(bio); } =20 -void __swap_writepage(struct folio *folio, struct swap_iocb **swap_plug) -{ - struct swap_info_struct *sis =3D __swap_entry_to_info(folio->swap); - - VM_BUG_ON_FOLIO(!folio_test_swapcache(folio), folio); - /* - * ->flags can be updated non-atomically, - * 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(folio, swap_plug); - /* - * ->flags can be updated non-atomically, - * but that will never affect SWP_SYNCHRONOUS_IO, so the data_race - * is safe. - */ - else if (data_race(sis->flags & SWP_SYNCHRONOUS_IO)) - swap_writepage_bdev_sync(folio, sis); - else - swap_writepage_bdev_async(folio, sis); -} - void swap_write_unplug(struct swap_iocb *sio) { struct iov_iter from; @@ -537,9 +518,10 @@ static bool swap_read_folio_zeromap(struct folio *foli= o) return true; } =20 -static void swap_read_folio_fs(struct folio *folio, struct swap_iocb **plu= g) +static void swap_read_folio_fs(struct swap_info_struct *sis, + struct folio *folio, + struct swap_iocb **plug) { - struct swap_info_struct *sis =3D __swap_entry_to_info(folio->swap); struct swap_iocb *sio =3D NULL; loff_t pos =3D swap_dev_pos(folio->swap); =20 @@ -571,8 +553,9 @@ static void swap_read_folio_fs(struct folio *folio, str= uct swap_iocb **plug) *plug =3D sio; } =20 -static void swap_read_folio_bdev_sync(struct folio *folio, - struct swap_info_struct *sis) +static void swap_read_folio_bdev_sync(struct swap_info_struct *sis, + struct folio *folio, + struct swap_iocb **plug) { struct bio_vec bv; struct bio bio; @@ -593,8 +576,9 @@ static void swap_read_folio_bdev_sync(struct folio *fol= io, put_task_struct(current); } =20 -static void swap_read_folio_bdev_async(struct folio *folio, - struct swap_info_struct *sis) +static void swap_read_folio_bdev_async(struct swap_info_struct *sis, + struct folio *folio, + struct swap_iocb **plug) { struct bio *bio; =20 @@ -608,6 +592,44 @@ static void swap_read_folio_bdev_async(struct folio *f= olio, submit_bio(bio); } =20 +static const struct swap_ops bdev_fs_swap_ops =3D { + .read_folio =3D swap_read_folio_fs, + .write_folio =3D swap_writepage_fs, +}; + +static const struct swap_ops bdev_sync_swap_ops =3D { + .read_folio =3D swap_read_folio_bdev_sync, + .write_folio =3D swap_writepage_bdev_sync, +}; + +static const struct swap_ops bdev_async_swap_ops =3D { + .read_folio =3D swap_read_folio_bdev_async, + .write_folio =3D swap_writepage_bdev_async, +}; + +int init_swap_ops(struct swap_info_struct *sis) +{ + /* + * ->flags can be updated non-atomically, but that will + * never affect SWP_FS_OPS, so the data_race is safe. + */ + if (data_race(sis->flags & SWP_FS_OPS)) + sis->ops =3D &bdev_fs_swap_ops; + /* + * ->flags can be updated non-atomically, but that will + * never affect SWP_SYNCHRONOUS_IO, so the data_race is safe. + */ + else if (data_race(sis->flags & SWP_SYNCHRONOUS_IO)) + sis->ops =3D &bdev_sync_swap_ops; + else + sis->ops =3D &bdev_async_swap_ops; + + if (!sis->ops || !sis->ops->read_folio || !sis->ops->write_folio) + return -EINVAL; + + return 0; +} + void swap_read_folio(struct folio *folio, struct swap_iocb **plug) { struct swap_info_struct *sis =3D __swap_entry_to_info(folio->swap); @@ -642,13 +664,7 @@ void swap_read_folio(struct folio *folio, struct swap_= iocb **plug) /* We have to read from slower devices. Increase zswap protection. */ zswap_folio_swapin(folio); =20 - if (data_race(sis->flags & SWP_FS_OPS)) { - swap_read_folio_fs(folio, plug); - } else if (synchronous) { - swap_read_folio_bdev_sync(folio, sis); - } else { - swap_read_folio_bdev_async(folio, sis); - } + sis->ops->read_folio(sis, folio, plug); =20 finish: if (workingset) { diff --git a/mm/swapfile.c b/mm/swapfile.c index 4840fd40f36f..8c42632e6765 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3780,6 +3780,15 @@ SYSCALL_DEFINE2(swapon, const char __user *, special= file, int, swap_flags) goto free_swap_zswap; } =20 + /* + * init_swap_ops() sets si->ops based on flags. It does not need + * swapon_mutex, and must complete before enable_swap_info() + * exposes the device. + */ + error =3D init_swap_ops(si); + if (error) + goto bad_swap_unlock_inode; + mutex_lock(&swapon_mutex); prio =3D DEF_SWAP_PRIO; if (swap_flags & SWAP_FLAG_PREFER) diff --git a/mm/zswap.c b/mm/zswap.c index 4b5149173b0e..192401f46de4 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1054,7 +1054,7 @@ static int zswap_writeback_entry(struct zswap_entry *= entry, folio_set_reclaim(folio); =20 /* start writeback */ - __swap_writepage(folio, NULL); + si->ops->write_folio(si, folio, NULL); =20 out: if (ret && ret !=3D -EEXIST) { --=20 2.52.0 From nobody Fri Jun 12 21:29:43 2026 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEB0C367299 for ; Tue, 12 May 2026 10:42:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582553; cv=none; b=aNEyUFXlAlhy1IaOyofQ7RrAz6jrjx2gLthcQOJheMa6/xFegQWJCAf3HOjWHEfvTZhcTtAuUKCAzW3VO3sChUP5+TL07NFJFspfYMsgTUfhXy9aPJkp1Pw2z8fdUiA29NRuDaT6K+zjt0sksvOwzSt8BMBkRu62yUjrXaP9dpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582553; c=relaxed/simple; bh=Ia6yRnx4GQ04MIqhfc6XCj9gqT2/2tXlhWFT2O1vPsw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=UOaX4H80UNtEbnpjT2PDxDwz0hEZ8OMxcXEvQlZZRl/2UyJyl2hMW2sYkupX54s0YH55pwwBvvKBGcTctEaWOWuldmHV5Pdf3ifUlBQJLrFMO7wuNwM5iwCwZv5vj/+ujMpD4D3aEG6loeB+ktVSJcJtiInS3/Al9XheneulBQY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Jg7op6ym; arc=none smtp.client-ip=95.215.58.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Jg7op6ym" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1778582549; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C4MCpeC/QI7aHjdJ7R96J+Wf7v/xQ/HqdMKtbliXTYQ=; b=Jg7op6ymUQq7eSQlbqukgQm4a8WnNw1RxBKdasWeQORHEXNOyuW/B6ETDbrlFy24vk73V6 2mrWF4l8/DeYIBmM8PUqo1q7je2X/p+6Qtnb6UaO42x3PSGkYJkm7VdkaIjM74qW41e82I 0J6WqNbjp08P5vuohUNLqkG+kV7f/m0= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, chrisl@kernel.org, usama.arif@linux.dev, baohua@kernel.org, kasong@tencent.com, nphamcs@gmail.com, shikemeng@huaweicloud.com, youngjun.park@lge.com, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH v6 3/3] mm/swap_io.c: rename swap_writepage_* to swap_write_folio_* Date: Tue, 12 May 2026 18:42:01 +0800 Message-ID: <20260512104201.716213-4-baoquan.he@linux.dev> In-Reply-To: <20260512104201.716213-1-baoquan.he@linux.dev> References: <20260512104201.716213-1-baoquan.he@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" All these swap_writepage_* functions handle a passed-in folio, not a page. This renaming makes them consistent with their counterpart swap_read_folio_* functions. Reviewed-by: Barry Song Reviewed-by: Nhat Pham Signed-off-by: Baoquan He Acked-by: Chris Li Acked-by: Kairui Song --- mm/swap_io.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/swap_io.c b/mm/swap_io.c index 3f9aee5b6a4d..ff38adfde0fa 100644 --- a/mm/swap_io.c +++ b/mm/swap_io.c @@ -374,7 +374,7 @@ static void sio_write_complete(struct kiocb *iocb, long= ret) mempool_free(sio, sio_pool); } =20 -static void swap_writepage_fs(struct swap_info_struct *sis, +static void swap_write_folio_fs(struct swap_info_struct *sis, struct folio *folio, struct swap_iocb **swap_plug) { @@ -411,7 +411,7 @@ static void swap_writepage_fs(struct swap_info_struct *= sis, *swap_plug =3D sio; } =20 -static void swap_writepage_bdev_sync(struct swap_info_struct *sis, +static void swap_write_folio_bdev_sync(struct swap_info_struct *sis, struct folio *folio, struct swap_iocb **plug) { @@ -432,7 +432,7 @@ static void swap_writepage_bdev_sync(struct swap_info_s= truct *sis, __end_swap_bio_write(&bio); } =20 -static void swap_writepage_bdev_async(struct swap_info_struct *sis, +static void swap_write_folio_bdev_async(struct swap_info_struct *sis, struct folio *folio, struct swap_iocb **plug) { @@ -594,17 +594,17 @@ static void swap_read_folio_bdev_async(struct swap_in= fo_struct *sis, =20 static const struct swap_ops bdev_fs_swap_ops =3D { .read_folio =3D swap_read_folio_fs, - .write_folio =3D swap_writepage_fs, + .write_folio =3D swap_write_folio_fs, }; =20 static const struct swap_ops bdev_sync_swap_ops =3D { .read_folio =3D swap_read_folio_bdev_sync, - .write_folio =3D swap_writepage_bdev_sync, + .write_folio =3D swap_write_folio_bdev_sync, }; =20 static const struct swap_ops bdev_async_swap_ops =3D { .read_folio =3D swap_read_folio_bdev_async, - .write_folio =3D swap_writepage_bdev_async, + .write_folio =3D swap_write_folio_bdev_async, }; =20 int init_swap_ops(struct swap_info_struct *sis) --=20 2.52.0