From nobody Tue Jun 16 02:34:55 2026 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (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 90AA53D2FEC for ; Wed, 15 Apr 2026 08:57:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776243438; cv=none; b=VDsx/ZYMIKvT3ku9NXkP61EkfMsq9C/AtGfO4q0+3ouGRxtp+AsexYLmq+wUcojBOCNExtvy6H4+J4JQUnvMpxBS+bLeCjeCl1M3OeqMshpRYHq8iQeVRClmVaOhvMcnMn23V/c9d7DayjyzDICET/KeICoD8RbRHPycNROBr4M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776243438; c=relaxed/simple; bh=GGF/FSDkd180GxuxR2GlmTPSdEQeK/XZv7h4JFdMJ48=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=MJsk53IUJTBY9S6JI2nNw6O8WsLXYvNp26ivTwW3TU20l2BRSA7uY6h66pl65hv4oCqqvIO3WORnA2fWP7W7hB8j9hZWcKqLQsMroM0y9RhHd0XE/uA5nsI06IaP8ZM7ZF/i4Hm4drZrA5ikg8haqDnKowZ2t3Uhjhs5bHJnzzU= 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=MheWrTxJ; arc=none smtp.client-ip=91.218.175.177 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="MheWrTxJ" 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=1776243434; 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=52HLBVvHVecdaxTy8P7ZBrFPBClgeVlPlb7Bxuv2UKI=; b=MheWrTxJEYOdf/Kyx1XxQdKXR06siIs9BpuMqrgbRC1jzBAiCtgjj3JHpw9wfpErU9q3wR wxvXlucBDP5CAfbcvLooGSr4Y4gYXlmijSPgtweXFaw4GyTHsRiEIqIpfjv7IlzKe1elPu KmUr7DE2FgzWFEC+rb6SLVky1JCGGOQ= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, 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 v3 1/3] mm/swap: rename mm/page_io.c to mm/swap_io.c Date: Wed, 15 Apr 2026 16:56:56 +0800 Message-ID: <20260415085658.993859-2-baoquan.he@linux.dev> In-Reply-To: <20260415085658.993859-1-baoquan.he@linux.dev> References: <20260415085658.993859-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 92eb723573aa..6fb19fe0bdd3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16948,7 +16948,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 bfafa637c458..81a80605fc6a 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -210,7 +210,7 @@ extern void swap_entries_free(struct swap_info_struct *= si, struct swap_cluster_info *ci, unsigned long offset, 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 a2c034660c80..4bf210bd677e 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 02:34:55 2026 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (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 D1A983D8137 for ; Wed, 15 Apr 2026 08:57:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776243445; cv=none; b=SCxc4mBKWO1oY09t6qpUfUE1NUrvfKjbDt74EtIOwG1WrhhLWdQSxPIF79YL+LOEBKmct/BFCnND0uu8N9ENNJ7M+ZWDdVJ2YgkWQSWG3TBe4zrURGZt5fpgDZmtnRSZq3obhqOjRtkAwWxCmEO20XjYhCyaZca76asqkDO5FOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776243445; c=relaxed/simple; bh=3ykh1LsFjEZWiC8yEQTlpiE96Jwic8ECaaSoqOC3W94=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=qfi8sT6wUOKo1s62xY5E4EboBNTwavANRl/4W1Rd/FQf0C5HMkdvpjOzHwdXeIidpHNrx2rLaImeiy3qPWa1pdR2VYn5S2ztpgrYI4r6IgDws+8s6soRErsWf+Ub47UeVcph4+l0HeB0k0pVZ6J3+cj5OQ6vNZu7KMsuo8n7Kik= 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=KsL0a7bC; arc=none smtp.client-ip=95.215.58.174 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="KsL0a7bC" 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=1776243441; 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=hS5qpEiCkYhxSwO473MIhVovQuf7CZrjA9Nb/Pirvks=; b=KsL0a7bC9pDxfCYS0pbMhEeCJ3V6Z4KmdX93mIJ4/P3N4/MA/we2Nm/qapyNOrPSY8UUuz 3QWCwZXwwB+CRKYKIgoYPWZCZ36T+vBk4qkYJwrSOmmTQYAw9PFUByeFGVosaBjYhLUeDK y2VmiVxwWKOc/yTQ1EZJwFuowO32vPg= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, 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 v3 2/3] mm/swap: use swap_ops to register swap device's methods Date: Wed, 15 Apr 2026 16:56:57 +0800 Message-ID: <20260415085658.993859-3-baoquan.he@linux.dev> In-Reply-To: <20260415085658.993859-1-baoquan.he@linux.dev> References: <20260415085658.993859-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 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 | 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 62fc7499b408..3069bbfd7a05 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -255,6 +255,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. */ @@ -300,6 +301,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 81a80605fc6a..0f4c597e3f28 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -213,6 +213,15 @@ extern void swap_entries_free(struct swap_info_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) @@ -222,7 +231,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 4bf210bd677e..602e9b871b30 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 (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(folio, swap_plug); - /* - * ->flags can be updated non-atomically (scan_swap_map_slots), - * 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 60e21414624b..7e1660f59c00 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3413,6 +3413,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, &span); diff --git a/mm/zswap.c b/mm/zswap.c index 16b2ef7223e1..d8930d9054df 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 02:34:55 2026 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.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 40A203D5230 for ; Wed, 15 Apr 2026 08:57:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776243455; cv=none; b=fXn3WuOYcTTW7+KG/NwpRNsd6y++XMO26yZ9p+QUPCVszuA5zaQhRiBiD8oQzU7RubDHMk9aM/pyZrRwd19yXzU8og715J2Q+T/MwzRldsLlzU3UEPbELWHFNgaAX2lQIC9dyO2eVTnyZWHwxHoeMTuSuIkmfq3TT+qN2z2HQQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776243455; c=relaxed/simple; bh=q67G54qk/ovmGllijXHuA7HNjQmD+TB8Wil8Oph7/AA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=dsMgrPFMVdPbyXNbDwvvue/GD0N8lnXxII8dFFuXbG2ER7xbyMyU8360bHjD/BZYi5rK6REJyYeAwt3jUFeNjsTJRJ35v6KiTTSl83xzquzjYfSXB9+rXPV2knuadvwC9Vad0uDUrRowoGJQiTPNFMt8cNsx/uPyn2Ud1Fgm/lw= 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=Go0uIRa0; arc=none smtp.client-ip=91.218.175.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="Go0uIRa0" 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=1776243451; 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=h8Q0yOP/JuEDCBeOqlI6zUOjJoYjm2ZTHveOpWLQl2Y=; b=Go0uIRa0WQa6Da4Qp3/MoP9lCX3U5mklASq9YslPWrDFn/d9iDJo4NhxNlFjRB+30WBBDv gqaqbBszsDtuln0CRDTs+C0NHE+ki4TKXWoaQf+lOXcMR+bFDgjN1JuRYL++ZAJWm8wM8k pW39m+Q0K+QqAPxTov2GkfHBZAjvJcE= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, 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 v3 3/3] mm/swap_io.c: rename swap_writepage_* to swap_write_folio_* Date: Wed, 15 Apr 2026 16:56:58 +0800 Message-ID: <20260415085658.993859-4-baoquan.he@linux.dev> In-Reply-To: <20260415085658.993859-1-baoquan.he@linux.dev> References: <20260415085658.993859-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 are hanlding passed in folio, but not page. And this renaming make them consistent with the their counterpart swap_read_folio_* functions. Reviewed-by: Barry Song Reviewed-by: Nhat Pham Signed-off-by: Baoquan He Acked-by: Chris Li --- 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 602e9b871b30..26f2daabb91f 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