From nobody Sat Jun 13 03:27:58 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 100E52264AA for ; Mon, 11 May 2026 07:33:59 +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=1778484841; cv=none; b=mI0mniWBfXVbP7N20tt45P59ZEeCQbAfBMfC/v/MXxygHfvR9VQv75RW1GQAmXAyro7m8s1w9mfmbbg6d9UP0NoFdxcPSdK0BeTel4PJZ2MWGNK2I1H3ri1j+xaOCccE4RC9EOhMVPFbekWNnyDiUJCp8bXvHCxaXocFZ6KY6YQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778484841; c=relaxed/simple; bh=FK/IDQzOanlr2rfo3DxhWYuKp3qrjfp1i9eeFx0WE78=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=TcTdnov4QnEl3aKU3B3XccLucIk5XRHmwT0gm75ROcveHqyS0coVFCxcYrJj1eIpuyYmxI2T1sSgot16v0H650pSi7upkw2s5IL4k111lWCWe1h7jofkaJpzKpkxsqKsqZv8gBNu/i5iHRjhsuxnaC/DWKCKZkA3Es+4GtyfST8= 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=L7XDCiAn; 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="L7XDCiAn" 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=1778484837; 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=QwxQWuscuSlOvfIaVW/y5JOMgvwD0lTwKLJaPKj4Tz0=; b=L7XDCiAn9cGkovp0tHRtBEkpbAkPsTafknLBru4J53shHav/HwmG2+SHIMsLLVVK06xBrs b4094Eg1cV8oyOVqiurdLGQqgTPqGH6+yIzFHzjHQqoKIf8VqxmzCA6URKv5cLoqjQES/5 ABCShgdefJGM49WTxOsRC76JIqhJ+QI= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, usama.arif@linux.dev, chrisl@kernel.org, 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 v5 1/3] mm/swap: rename mm/page_io.c to mm/swap_io.c Date: Mon, 11 May 2026 15:33:32 +0800 Message-ID: <20260511073334.635682-2-baoquan.he@linux.dev> In-Reply-To: <20260511073334.635682-1-baoquan.he@linux.dev> References: <20260511073334.635682-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 --- 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 b2040011a386..4cc5fad4446f 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 70cea9e24d2f..91b33d955e63 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 Sat Jun 13 03:27:58 2026 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 D30532264AA for ; Mon, 11 May 2026 07:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778484848; cv=none; b=V+aO7ABzhodQvBR2C/BzaCQTp+IE9jEgestR/5VKaDrX3nYBJXWzEeY0+kJpRmufaegA3f40RtQrP8FyOryvBeGYm5cdAFK78RgBcCi+qLJL0AZsi0gpM5x5w3LPZQRgEYhAwCbOLW48KvydgE8S+KSiJApdYtrHNZ1iEtyWH64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778484848; c=relaxed/simple; bh=frrGXxrxmJa3y4WAXnxnhNDu4aIgFcZQAdChcdljYp0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=PPwSw05Z9v+y9m2d3O83ukrG8W3W2l8s6lwLjwDOLhquLVFMWTPG6iHvdxL5477XmGbKeUs3IHzfc+bCh371Rkg/w0Y69BRHfxYRPcPMFR9XjqBsJwQhpLIK86liNfLDL7fydST5MY1zy/JuQBC/+L7606vth0QOqcl3T01Fk1w= 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=vLdsIkCq; arc=none smtp.client-ip=91.218.175.181 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="vLdsIkCq" 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=1778484844; 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=I9ohb/rs9Y+WQKJf+igG7d6Bz477Qx/eAauYzpOS8iw=; b=vLdsIkCqpNtI80eNslseb7Zdx0XNwgn/mDOt5RR4W/T0IrdI8YgKUuUP9kf5JUK0Fy6YPP 8xVjn0IwhxlEZUbmeKdr0zVz4oMWWZM9YPPB1MZT2Fle0cq+DR2g1rO17E/q37fUzKUmYR EZVGnt2cyHvTMWgMeI0I6VDtgtEnuDU= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, usama.arif@linux.dev, chrisl@kernel.org, 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 v5 2/3] mm/swap: use swap_ops to register swap device's methods Date: Mon, 11 May 2026 15:33:33 +0800 Message-ID: <20260511073334.635682-3-baoquan.he@linux.dev> In-Reply-To: <20260511073334.635682-1-baoquan.he@linux.dev> References: <20260511073334.635682-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 Acked-by: Usama Arif 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 | 4 ++ mm/zswap.c | 2 +- 5 files changed, 75 insertions(+), 45 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 7a09df6977a5..8edd629e30ba 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 91b33d955e63..cef884339717 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 9174f1eeffb0..82d2c9b35b11 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3518,6 +3518,10 @@ SYSCALL_DEFINE2(swapon, const char __user *, special= file, int, swap_flags) goto bad_swap_unlock_inode; } =20 + error =3D init_swap_ops(si); + if (error) + 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 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 Sat Jun 13 03:27:58 2026 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 B644A38238C for ; Mon, 11 May 2026 07:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778484855; cv=none; b=oN0WB+obHsX0H8feaSHisLxh1aiVst3KlvoE8TXwrLMpQR+H/aKz/ZacAt/uLBHRy6ceIUrnHyjdIsIs/ImfIsr8fHvuf6qNAxLJs4C6pIlj9WzBegzT07ltR043G+nMImAYvngyAY43eYe6xjnyknxMEDXh1loy9ntOrp/QKas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778484855; c=relaxed/simple; bh=UlLB8LXAQUWG1/+VGLQMd1JHZao/kL9GDJrJLh9tntc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=qUYdwVUm6f4bRv1deKrEz/aOgDWp3fsjP8JF5fT4kaJB9zpYy3oZPu6cSDU8zvhPrCreLwLmoW/B8hbDsAu2UIJqXOXutDaA2Ldas+HBGDWRfNsIZfua7P0xnrWyUjb20oYDxs7iVsQ3cDM1aoT4/c5gi6cBqhJVlEaVczPo92k= 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=qZhPjRfR; arc=none smtp.client-ip=91.218.175.182 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="qZhPjRfR" 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=1778484851; 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=EgE7Huk+NLVuTxSVwDwhS2p2qIJr1u27I3Kmv9Snavo=; b=qZhPjRfRh8ZPZ7+m2vaP7uRJmCUuqnlQg5HBxVUeyckkM+howS2pTPP3ZIuWEzAdWTvx8A EULixie4m6JFfV0Pt3ImqpGurCjCwl6a08/1GOSxaKcORBG1Cx96RrDjg1+6c7htGEHg4k fYS/Hlb6Yr1b3RNhnTI2l8lFWd5c0g0= From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, usama.arif@linux.dev, chrisl@kernel.org, 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 v5 3/3] mm/swap_io.c: rename swap_writepage_* to swap_write_folio_* Date: Mon, 11 May 2026 15:33:34 +0800 Message-ID: <20260511073334.635682-4-baoquan.he@linux.dev> In-Reply-To: <20260511073334.635682-1-baoquan.he@linux.dev> References: <20260511073334.635682-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 --- 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 cef884339717..e2710d5fb44e 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