Re: [PATCH v4 1/3] mm/swap: colocate page-cluster sysctl with swap readahead

From: Barry Song

Date: Wed Jun 03 2026 - 20:15:05 EST


On Wed, Jun 3, 2026 at 9:05 PM Jianyue Wu <wujianyue000@xxxxxxxxx> wrote:
>
> page_cluster and the vm.page-cluster sysctl are only used by swap-in
> readahead in swap_state.c. Move them out of swap.c together with
> swap_readahead_setup(), and make page_cluster static to that file.
>
> Rename swap_setup() while moving it as well. The helper is internal to
> MM and now only sets up swap readahead defaults and its sysctl hook, so
> the more specific name matches its reduced scope.
>
> swap_setup() previously lived in mm/swap.c, which is built
> unconditionally, so the vm.page-cluster sysctl was registered also on
> CONFIG_SWAP=n kernels. swap_readahead_setup() is now a no-op stub when
> CONFIG_SWAP is disabled, so vm.page-cluster is no longer registered
> there. The knob only tunes swap-in readahead and had no effect without
> swap.
>
> Suggested-by: Baoquan He <bhe@xxxxxxxxxx>
> Suggested-by: Barry Song <baohua@xxxxxxxxxx>
> Signed-off-by: Jianyue Wu <wujianyue000@xxxxxxxxx>
> ---

Reviewed-by: Barry Song <baohua@xxxxxxxxxx>