From 4e1d77a8f382a0ef4dd7732bb1986c8143600def Mon Sep 17 00:00:00 2001 From: Tal Zussman Date: Wed, 25 Feb 2026 18:44:27 -0500 Subject: folio_batch: rename pagevec.h to folio_batch.h struct pagevec was removed in commit 1e0877d58b1e ("mm: remove struct pagevec"). Rename include/linux/pagevec.h to reflect reality and update includes tree-wide. Add the new filename to MAINTAINERS explicitly, as it no longer matches the "include/linux/page[-_]*" pattern in MEMORY MANAGEMENT - CORE. Link: https://lkml.kernel.org/r/20260225-pagevec_cleanup-v2-3-716868cc2d11@columbia.edu Signed-off-by: Tal Zussman Acked-by: David Hildenbrand (Arm) Reviewed-by: Jan Kara Acked-by: Zi Yan Reviewed-by: Lorenzo Stoakes (Oracle) Cc: Chris Li Cc: Christian Brauner Cc: Matthew Wilcox (Oracle) Signed-off-by: Andrew Morton --- MAINTAINERS | 1 + drivers/gpu/drm/drm_gem.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 2 +- drivers/gpu/drm/i915/gt/intel_gtt.h | 2 +- drivers/gpu/drm/i915/i915_gpu_error.c | 2 +- fs/btrfs/compression.c | 2 +- fs/btrfs/extent_io.c | 2 +- fs/btrfs/tests/extent-io-tests.c | 2 +- fs/buffer.c | 2 +- fs/ceph/addr.c | 2 +- fs/ext4/inode.c | 2 +- fs/f2fs/checkpoint.c | 2 +- fs/f2fs/compress.c | 2 +- fs/f2fs/data.c | 2 +- fs/f2fs/node.c | 2 +- fs/gfs2/aops.c | 2 +- fs/hugetlbfs/inode.c | 2 +- fs/nilfs2/btree.c | 2 +- fs/nilfs2/page.c | 2 +- fs/nilfs2/segment.c | 2 +- fs/ramfs/file-nommu.c | 2 +- include/linux/folio_batch.h | 105 ++++++++++++++++++++++++++++++ include/linux/folio_queue.h | 2 +- include/linux/iomap.h | 2 +- include/linux/pagevec.h | 105 ------------------------------ include/linux/sunrpc/svc.h | 2 +- include/linux/writeback.h | 2 +- mm/filemap.c | 2 +- mm/gup.c | 2 +- mm/memcontrol.c | 2 +- mm/mlock.c | 2 +- mm/page-writeback.c | 2 +- mm/page_alloc.c | 2 +- mm/shmem.c | 2 +- mm/swap.c | 2 +- mm/swap_state.c | 2 +- mm/truncate.c | 2 +- mm/vmscan.c | 2 +- 38 files changed, 141 insertions(+), 140 deletions(-) create mode 100644 include/linux/folio_batch.h delete mode 100644 include/linux/pagevec.h diff --git a/MAINTAINERS b/MAINTAINERS index 7049d85c586e..7a1b94a4aea2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16653,6 +16653,7 @@ L: linux-mm@kvack.org S: Maintained W: http://www.linux-mm.org T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm +F: include/linux/folio_batch.h F: include/linux/gfp.h F: include/linux/gfp_types.h F: include/linux/highmem.h diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 891c3bff5ae0..dc4534fb175c 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c index 720a9ad39aa2..06543ae60706 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c @@ -3,7 +3,7 @@ * Copyright © 2014-2016 Intel Corporation */ -#include +#include #include #include #include diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h b/drivers/gpu/drm/i915/gt/intel_gtt.h index 9d3a3ad567a0..b54ee4f25af1 100644 --- a/drivers/gpu/drm/i915/gt/intel_gtt.h +++ b/drivers/gpu/drm/i915/gt/intel_gtt.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index a99b4e45d26c..ffe5f24594c9 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 85199944c1eb..de40b8934725 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 5f97a3d2a8d7..89649ef5107a 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include "extent_io.h" diff --git a/fs/btrfs/tests/extent-io-tests.c b/fs/btrfs/tests/extent-io-tests.c index a0187d6163df..b2aacf846c8b 100644 --- a/fs/btrfs/tests/extent-io-tests.c +++ b/fs/btrfs/tests/extent-io-tests.c @@ -4,7 +4,7 @@ */ #include -#include +#include #include #include #include diff --git a/fs/buffer.c b/fs/buffer.c index 22b43642ba57..f3122160ee2d 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 2090fc78529c..bbeafbc777ee 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 396dc3a5d16b..58f982885187 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 6dd39b7de11a..0143365c07dc 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 8c76400ba631..614e00b8ffdc 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include "f2fs.h" #include "node.h" diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 338df7a2aea6..90e8ef625d82 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 74992fd9c9b6..ba0272314528 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include "f2fs.h" diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index e79ad087512a..dae3dc4ee6f7 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 22c799000edb..2ec3e4231252 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index dd0c8e560ef6..b400cfcdc803 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include "nilfs.h" #include "page.h" #include "btnode.h" diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 56c4da417b6a..a9d8aa65416f 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include "nilfs.h" #include "page.h" diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 098a3bd103e0..6d62de64a309 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index 0f8e838ece07..2f79bcb89d2e 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/linux/folio_batch.h b/include/linux/folio_batch.h new file mode 100644 index 000000000000..a2f3d3043f7e --- /dev/null +++ b/include/linux/folio_batch.h @@ -0,0 +1,105 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * include/linux/folio_batch.h + * + * In many places it is efficient to batch an operation up against multiple + * folios. A folio_batch is a container which is used for that. + */ + +#ifndef _LINUX_FOLIO_BATCH_H +#define _LINUX_FOLIO_BATCH_H + +#include + +/* 31 pointers + header align the folio_batch structure to a power of two */ +#define PAGEVEC_SIZE 31 + +struct folio; + +/** + * struct folio_batch - A collection of folios. + * + * The folio_batch is used to amortise the cost of retrieving and + * operating on a set of folios. The order of folios in the batch may be + * significant (eg delete_from_page_cache_batch()). Some users of the + * folio_batch store "exceptional" entries in it which can be removed + * by calling folio_batch_remove_exceptionals(). + */ +struct folio_batch { + unsigned char nr; + unsigned char i; + bool percpu_pvec_drained; + struct folio *folios[PAGEVEC_SIZE]; +}; + +/** + * folio_batch_init() - Initialise a batch of folios + * @fbatch: The folio batch. + * + * A freshly initialised folio_batch contains zero folios. + */ +static inline void folio_batch_init(struct folio_batch *fbatch) +{ + fbatch->nr = 0; + fbatch->i = 0; + fbatch->percpu_pvec_drained = false; +} + +static inline void folio_batch_reinit(struct folio_batch *fbatch) +{ + fbatch->nr = 0; + fbatch->i = 0; +} + +static inline unsigned int folio_batch_count(const struct folio_batch *fbatch) +{ + return fbatch->nr; +} + +static inline unsigned int folio_batch_space(const struct folio_batch *fbatch) +{ + return PAGEVEC_SIZE - fbatch->nr; +} + +/** + * folio_batch_add() - Add a folio to a batch. + * @fbatch: The folio batch. + * @folio: The folio to add. + * + * The folio is added to the end of the batch. + * The batch must have previously been initialised using folio_batch_init(). + * + * Return: The number of slots still available. + */ +static inline unsigned folio_batch_add(struct folio_batch *fbatch, + struct folio *folio) +{ + fbatch->folios[fbatch->nr++] = folio; + return folio_batch_space(fbatch); +} + +/** + * folio_batch_next - Return the next folio to process. + * @fbatch: The folio batch being processed. + * + * Use this function to implement a queue of folios. + * + * Return: The next folio in the queue, or NULL if the queue is empty. + */ +static inline struct folio *folio_batch_next(struct folio_batch *fbatch) +{ + if (fbatch->i == fbatch->nr) + return NULL; + return fbatch->folios[fbatch->i++]; +} + +void __folio_batch_release(struct folio_batch *fbatch); + +static inline void folio_batch_release(struct folio_batch *fbatch) +{ + if (folio_batch_count(fbatch)) + __folio_batch_release(fbatch); +} + +void folio_batch_remove_exceptionals(struct folio_batch *fbatch); +#endif /* _LINUX_FOLIO_BATCH_H */ diff --git a/include/linux/folio_queue.h b/include/linux/folio_queue.h index adab609c972e..0d3765fa9d1d 100644 --- a/include/linux/folio_queue.h +++ b/include/linux/folio_queue.h @@ -14,7 +14,7 @@ #ifndef _LINUX_FOLIO_QUEUE_H #define _LINUX_FOLIO_QUEUE_H -#include +#include #include /* diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 99b7209dabd7..4551613cea2f 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include struct address_space; struct fiemap_extent_info; diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h deleted file mode 100644 index 007affabf335..000000000000 --- a/include/linux/pagevec.h +++ /dev/null @@ -1,105 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * include/linux/pagevec.h - * - * In many places it is efficient to batch an operation up against multiple - * folios. A folio_batch is a container which is used for that. - */ - -#ifndef _LINUX_PAGEVEC_H -#define _LINUX_PAGEVEC_H - -#include - -/* 31 pointers + header align the folio_batch structure to a power of two */ -#define PAGEVEC_SIZE 31 - -struct folio; - -/** - * struct folio_batch - A collection of folios. - * - * The folio_batch is used to amortise the cost of retrieving and - * operating on a set of folios. The order of folios in the batch may be - * significant (eg delete_from_page_cache_batch()). Some users of the - * folio_batch store "exceptional" entries in it which can be removed - * by calling folio_batch_remove_exceptionals(). - */ -struct folio_batch { - unsigned char nr; - unsigned char i; - bool percpu_pvec_drained; - struct folio *folios[PAGEVEC_SIZE]; -}; - -/** - * folio_batch_init() - Initialise a batch of folios - * @fbatch: The folio batch. - * - * A freshly initialised folio_batch contains zero folios. - */ -static inline void folio_batch_init(struct folio_batch *fbatch) -{ - fbatch->nr = 0; - fbatch->i = 0; - fbatch->percpu_pvec_drained = false; -} - -static inline void folio_batch_reinit(struct folio_batch *fbatch) -{ - fbatch->nr = 0; - fbatch->i = 0; -} - -static inline unsigned int folio_batch_count(const struct folio_batch *fbatch) -{ - return fbatch->nr; -} - -static inline unsigned int folio_batch_space(const struct folio_batch *fbatch) -{ - return PAGEVEC_SIZE - fbatch->nr; -} - -/** - * folio_batch_add() - Add a folio to a batch. - * @fbatch: The folio batch. - * @folio: The folio to add. - * - * The folio is added to the end of the batch. - * The batch must have previously been initialised using folio_batch_init(). - * - * Return: The number of slots still available. - */ -static inline unsigned folio_batch_add(struct folio_batch *fbatch, - struct folio *folio) -{ - fbatch->folios[fbatch->nr++] = folio; - return folio_batch_space(fbatch); -} - -/** - * folio_batch_next - Return the next folio to process. - * @fbatch: The folio batch being processed. - * - * Use this function to implement a queue of folios. - * - * Return: The next folio in the queue, or NULL if the queue is empty. - */ -static inline struct folio *folio_batch_next(struct folio_batch *fbatch) -{ - if (fbatch->i == fbatch->nr) - return NULL; - return fbatch->folios[fbatch->i++]; -} - -void __folio_batch_release(struct folio_batch *fbatch); - -static inline void folio_batch_release(struct folio_batch *fbatch) -{ - if (folio_batch_count(fbatch)) - __folio_batch_release(fbatch); -} - -void folio_batch_remove_exceptionals(struct folio_batch *fbatch); -#endif /* _LINUX_PAGEVEC_H */ diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 4dc14c7a711b..a11acf5cd63b 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include /* diff --git a/include/linux/writeback.h b/include/linux/writeback.h index e530112c4b3a..62552a2ce5b9 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include struct bio; diff --git a/mm/filemap.c b/mm/filemap.c index 406cef06b684..7cc6607dc28f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/mm/gup.c b/mm/gup.c index 8e7dc2c6ee73..ad9ded39609c 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include diff --git a/mm/memcontrol.c b/mm/memcontrol.c index eb54cdf99624..87614cfc4a3e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/mm/mlock.c b/mm/mlock.c index 2f699c3497a5..1a92d16f3684 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 601a5e048d12..1009bb042ba4 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d88c8c67ac0b..74b603872f34 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/mm/shmem.c b/mm/shmem.c index cfed6c3ff853..149fdb051170 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -61,7 +61,7 @@ static struct vfsmount *shm_mnt __ro_after_init; #include #include #include -#include +#include #include #include #include diff --git a/mm/swap.c b/mm/swap.c index bb19ccbece46..2e517ede6561 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/mm/swap_state.c b/mm/swap_state.c index 32d9d877bda8..a0c64db2b275 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/mm/truncate.c b/mm/truncate.c index 12467c1bd711..df0b7a7e6aff 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/mm/vmscan.c b/mm/vmscan.c index 2c954d370048..4ab461f8c65a 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include #include -- cgit v1.2.3