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

From: Jianyue Wu

Date: Tue Jun 30 2026 - 21:27:03 EST


On Wed, Jul 1, 2026 at 12:34 AM Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
>
> On Wed, Jul 01, 2026 at 12:27:32AM +0800, Jianyue Wu 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>
> > Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> > Signed-off-by: Jianyue Wu <wujianyue000@xxxxxxxxx>
>
> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>
>
> Btw, I suggested this:
>
> https://lore.kernel.org/all/adUTC-7iyOAUlhR7@xxxxxxxxxxx/

Hi Johannes,

Sorry I missed your Suggested-by tag on patch 1/3. Exactly, I moved
page_cluster and the vm.page-cluster sysctl into mm/swap_state.c
as you suggested.

I'll add it in v7.

Thanks for the review :)