[PATCH v4 0/3] mm: clean up folio LRU and swap declarations

From: Jianyue Wu

Date: Wed Jun 03 2026 - 09:16:22 EST


The previous version moved the folio LRU helpers out of mm/swap.c in
one step. Based on review feedback from Johannes, Baoquan and Barry,
split the cleanup into smaller steps:

- move the page-cluster sysctl next to swap readahead in mm/swap_state.c
- rename mm/swap.c to mm/folio_lru.c after the swap-specific bits move out
- move MM-internal reclaim declarations out of include/linux/swap.h

After this series, swap cache and swap-in readahead stay in mm/swap_state.c,
folio LRU helpers live in mm/folio_lru.c, and MM-internal reclaim/workingset
declarations move from include/linux/swap.h to mm/internal.h (public LRU
helpers used outside mm/ remain in swap.h).

The first patch handles the swap-specific page-cluster state before the
file rename, so the rename commit only carries folio LRU code. The last
patch keeps the LRU helpers used outside mm/ in include/linux/swap.h and
moves the internal reclaim/workingset declarations to mm/internal.h.

This series is based on Christoph Hellwig's swap_ops series, which
moves swap I/O dispatch behind swap_ops and leaves mm/swap.c with less
swap-specific state. That makes the folio LRU cleanup more natural to
split out on top.

https://lore.kernel.org/r/20260528124559.2566481-1-hch@xxxxxx

To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
To: Chris Li <chrisl@xxxxxxxxxx>
To: Kairui Song <kasong@xxxxxxxxxxx>
To: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
To: Nhat Pham <nphamcs@xxxxxxxxx>
To: Baoquan He <bhe@xxxxxxxxxx>
To: Barry Song <baohua@xxxxxxxxxx>
To: Youngjun Park <youngjun.park@xxxxxxx>
To: Qi Zheng <qi.zheng@xxxxxxxxx>
To: Shakeel Butt <shakeel.butt@xxxxxxxxx>
To: Axel Rasmussen <axelrasmussen@xxxxxxxxxx>
To: Yuanchu Xie <yuanchu@xxxxxxxxxx>
To: Wei Xu <weixugc@xxxxxxxxxx>
To: Johannes Weiner <hannes@xxxxxxxxxxx>
To: David Hildenbrand <david@xxxxxxxxxx>
To: Michal Hocko <mhocko@xxxxxxxxxx>
To: Lorenzo Stoakes <ljs@xxxxxxxxxx>
To: Liam R. Howlett <liam@xxxxxxxxxxxxx>
To: Vlastimil Babka <vbabka@xxxxxxxxxx>
To: Mike Rapoport <rppt@xxxxxxxxxx>
To: Suren Baghdasaryan <surenb@xxxxxxxxxx>
To: Michal Hocko <mhocko@xxxxxxxx>
To: Hugh Dickins <hughd@xxxxxxxxxx>
To: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
To: Jonathan Corbet <corbet@xxxxxxx>
To: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
Cc: linux-mm@xxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: linux-doc@xxxxxxxxxxxxxxx
Signed-off-by: Jianyue Wu <wujianyue000@xxxxxxxxx>

Changes in v4:
- Address Baoquan He's review on v3: align patch 2 subject with
rename-only scope; fix vm.rst sysctl documentation; refresh file
header comments in mm/folio_lru.c and swap.h declaration comments.
- Expand patch 1 commit message on CONFIG_SWAP=n vm.page-cluster
registration (also on CONFIG_SWAP=n kernels).
- Link to v3: https://lore.kernel.org/all/20260602-ch-swap-series-plus-folio-lru-cleanup-v3-0-5bbb567f8c99@xxxxxxxxx

---
Jianyue Wu (3):
mm/swap: colocate page-cluster sysctl with swap readahead
mm: rename swap.c to folio_lru.c
mm: move reclaim-internal declarations out of swap.h

Documentation/admin-guide/sysctl/vm.rst | 3 --
Documentation/core-api/mm-api.rst | 2 +-
MAINTAINERS | 3 +-
include/linux/swap.h | 75 +++------------------------------
mm/Makefile | 2 +-
mm/{swap.c => folio_lru.c} | 46 ++------------------
mm/internal.h | 68 ++++++++++++++++++++++++++++++
mm/memfd.c | 1 +
mm/swap.h | 8 +++-
mm/swap_state.c | 37 ++++++++++++++++
mm/vmscan.c | 2 +-
11 files changed, 126 insertions(+), 121 deletions(-)
---
base-commit: d7be408821acadd7d713d1da16a6742886799114
change-id: 20260531-ch-swap-series-plus-folio-lru-cleanup-d9781c8332dc

Best regards,
--
Jianyue Wu <wujianyue000@xxxxxxxxx>