From nobody Tue Jun 16 06:34:03 2026 Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) (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 84AF61A9F97 for ; Fri, 17 Apr 2026 03:40:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776397216; cv=none; b=ueI2VQ9nwE4FJrCmEIhcWWIL+Ij9uRcmVWETiI+Ist5vRh+MSWFnFEetQH39wuDYW318vt0l8JMe/sKw+GVuRqXSIxNwaxhYX48CL4TFFFn9uY3zy1BlfP6WDPzn+g1stf7kkmnDuIntBbAOnOkgYlLJuCiha8ljGg55KUcK6ls= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776397216; c=relaxed/simple; bh=MQW60gijdoW2Eh4fWYK79qFdGvzB1utlsftPlDi8XiI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=jbqzhE+yuJwPlCEa00tJ3nFsoLSFH0BSrnj4mbf4YUuo3JODbDQiE53hxuaKY7B9mZ5yCImLOBpXpySjMq35TogT54/Y0pwv7gJER/H6Mgi+UQ10lIhqV0ot+dZQM9NaBcx0q8QovVhzG9MYik47pUJ/N/PG5bno0q8cTn1Pv+s= 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=pKcV3wAV; arc=none smtp.client-ip=91.218.175.180 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="pKcV3wAV" 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=1776397213; 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=/HAo61uBKpFz6MK3WD95e+rqHXxilBo9frJ5Jqo/JHM=; b=pKcV3wAVNa2aMZsNf6QIOIGIeLvhbX5oaOMCbSNsF+DiEX1JOmeqYmXUsjBfP3bhu6Hp00 3C74ji4TmR7Y04vTi/Ig0/oZ8Fvp98QDmfskN2QnlE2akNsNVNCj356Vz3E6G00IC+C0RN 7TvpSzI/Nk7H+hsiSTefYjLcjCz3NLY= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, usama.arif@linux.dev, baohua@kernel.org, chrisl@kernel.org, kasong@tencent.com, nphamcs@gmail.com, shikemeng@huaweicloud.com, youngjun.park@lge.com, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH v4 1/3] mm/swap: rename mm/page_io.c to mm/swap_io.c Date: Fri, 17 Apr 2026 11:39:49 +0800 Message-ID: <20260417033951.1111038-2-baoquan.he@linux.dev> In-Reply-To: <20260417033951.1111038-1-baoquan.he@linux.dev> References: <20260417033951.1111038-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 Acked-by: Chris Li Signed-off-by: Baoquan He --- 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 447189411512..c7b5b6f5fa50 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17002,7 +17002,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 330abc5ab7b4..a62c02ab0551 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 Tue Jun 16 06:34:03 2026 Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) (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 2A2A0286AC for ; Fri, 17 Apr 2026 03:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776397225; cv=none; b=Tr1Jg4oHFxYkYPCpFGMMt9rYTUdzYvNVLwIk+VmTeCwF9aQaKJdxRI9FCCTyEKyBjH7WuiAUeYjw+QCN2uFBZjdRtkMjBFxwf6/2424TtjXfBMIEh/BuM2TEKix9AxH6hKjMvNyX1uw/buuzwdeBb0doyQnsfrHRclzKObG8beI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776397225; c=relaxed/simple; bh=nS9xgnYN40ewe8NUKcZZVHwhQ/qb+U61DKkt0Rf6WnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=r2tQf33k+xiGXfLjdulHHhUc95rJ9iCUK1ogdlN4sKIzweLnuTJMnZGWrR1Q9YzhNgp4yOSz6CaJxfcxcyHM0xwvCcrHEI+V1RRfA6tFm76MvaI3iAUUZ//2X90MfKPGjjHLjh92RHyo6PqayuJLYdjwaEmcbLZKaGkyA83jbZ4= 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=B93nttDD; arc=none smtp.client-ip=91.218.175.185 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="B93nttDD" 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=1776397222; 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=l9AobA3Z4Rd4ojmq7cfWKU+ZkIrg4qqvBUWzGO8bbik=; b=B93nttDD5CH6IrZjdWxFJ7z5PAxXKUabxWlNb6hm3n+LNpXFl/TB44wNf2okEAL0sfldkv bB2D7FJmEyLQpFSJxJh4H6DCNJv6/G/wyE57Tzc3RObNiDcPQgsIAB04BrtkbCLkiNpkpA Xf4NT4Lmdvs/cwtF7aHDDZygIgc190w= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, usama.arif@linux.dev, baohua@kernel.org, chrisl@kernel.org, kasong@tencent.com, nphamcs@gmail.com, shikemeng@huaweicloud.com, youngjun.park@lge.com, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH v4 2/3] mm/swap: use swap_ops to register swap device's methods Date: Fri, 17 Apr 2026 11:39:50 +0800 Message-ID: <20260417033951.1111038-3-baoquan.he@linux.dev> In-Reply-To: <20260417033951.1111038-1-baoquan.he@linux.dev> References: <20260417033951.1111038-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 operations adapted into swap_ops. Suggested-by: Chris Li Co-developed-by: Barry Song Signed-off-by: Barry Song Signed-off-by: Baoquan He Acked-by: Chris Li Acked-by: Usama Arif --- include/linux/swap.h | 2 + mm/swap.h | 10 ++++- mm/swap_io.c | 102 +++++++++++++++++++++++++------------------ mm/swapfile.c | 5 +++ mm/zswap.c | 2 +- 5 files changed, 76 insertions(+), 45 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 4b1f13b5bbad..5fdda26f5c1d 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -242,6 +242,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. */ @@ -282,6 +283,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 a62c02ab0551..1b054a122f53 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; @@ -279,7 +280,7 @@ int swap_writeout(struct folio *folio, struct swap_iocb= **swap_plug) return AOP_WRITEPAGE_ACTIVATE; } =20 - __swap_writepage(folio, swap_plug); + sis->ops->write_folio(sis, folio, swap_plug); return 0; out_unlock: folio_unlock(folio); @@ -369,10 +370,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 @@ -405,8 +407,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; @@ -425,8 +428,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 @@ -442,29 +446,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; @@ -533,9 +514,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 @@ -567,8 +549,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; @@ -589,8 +572,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 @@ -604,6 +588,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 -1; + + 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); @@ -638,13 +660,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 9174f1eeffb0..af81fa212f1e 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3518,6 +3518,11 @@ SYSCALL_DEFINE2(swapon, const char __user *, special= file, int, swap_flags) goto bad_swap_unlock_inode; } =20 + if (init_swap_ops(si)) { + error =3D -EINVAL; + goto bad_swap_unlock_inode; + } + si->max =3D maxpages; si->pages =3D maxpages - 1; nr_extents =3D setup_swap_extents(si, swap_file, &span); diff --git a/mm/zswap.c b/mm/zswap.c index 0823cadd02b6..b699413a2526 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1061,7 +1061,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 Tue Jun 16 06:34:03 2026 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (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 4ED82286AC for ; Fri, 17 Apr 2026 03:40:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776397248; cv=none; b=mbGPSYXDs0Twtt8zRe4+YNVCUYDD4C+cgk+izHMTeOQUkmjo2GRigryr4YpVJbLkrUv84Kz7HLJbWqgZR1G4wSYkGP4l3SA8Wqa4SwaVL0aOlR1FJ4ygb/H6tvMYizA1g5kEC97JT9GxEnpiqyfgtv3/Bf51cgVNJFEr7RKI9Yw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776397248; c=relaxed/simple; bh=J/9Mdu+Ssznv1EkK/0i0DuycdjjKY3HXUT+/7qbnurM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=F/fd8QMXNY6thfFqQL4Zd7w7PHqWIcPcv7j6d6T1zcS2stTBd1fl4UMXlGHK7xZqwHExV5s8BnicBE9HWJH1CgEkpL1eIValeHqlA/z7CKxzdV+IQXph5qmUoBastHxQFIxntdb0wAlha9cKdZ8SV5ZG6NUwck+sMeVk+dJIDQg= 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=CWK7pZ4f; arc=none smtp.client-ip=91.218.175.186 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="CWK7pZ4f" 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=1776397245; 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=u7ww5x3caJvrufa945Qbb7g+cuzkYOKwE0WoRtPhhBc=; b=CWK7pZ4f7u8FQDcEqqw2AQspzGWC6HZdUHX0baE665ZMTj4JEbfYnKAP03v9atFfkr0zyJ 82TRw3h0dg0AS8Ac+g+O2y4hJHfSkerfvHhATBK1dL2RGGhLFnQWUdhH5rCAv6bPa9M5pc 9rc1srAZhQc9MMnLaHOVFg4c2JCrCzg= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, usama.arif@linux.dev, baohua@kernel.org, chrisl@kernel.org, kasong@tencent.com, nphamcs@gmail.com, shikemeng@huaweicloud.com, youngjun.park@lge.com, linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH v4 3/3] mm/swap_io.c: rename swap_writepage_* to swap_write_folio_* Date: Fri, 17 Apr 2026 11:39:51 +0800 Message-ID: <20260417033951.1111038-4-baoquan.he@linux.dev> In-Reply-To: <20260417033951.1111038-1-baoquan.he@linux.dev> References: <20260417033951.1111038-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 Acked-by: Chris Li Signed-off-by: Baoquan He --- 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 1b054a122f53..50a16148b919 100644 --- a/mm/swap_io.c +++ b/mm/swap_io.c @@ -370,7 +370,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) { @@ -407,7 +407,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) { @@ -428,7 +428,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) { @@ -590,17 +590,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