Re: [PATCH v2] mm/swapfile.c: introduce function alloc_swap_scan_list()

From: Chris Li
Date: Tue Aug 12 2025 - 00:50:46 EST


On Mon, Aug 11, 2025 at 9:24 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Sat, 9 Aug 2025 03:51:48 +0800 Kairui Song <ryncsn@xxxxxxxxx> wrote:
>
> > On Fri, Aug 8, 2025 at 3:48 PM Chris Li <chrisl@xxxxxxxxxx> wrote:
> > >
> > > This the alloc_swap_scan_list() will scan the whole list or the first
> > > cluster.
> >
> > Hi Chris,
> >
> > This sentence reads strange to me, but English is not my native
> > language so I'm not very sure about it.

Ack. My bad.

>
> Yes, I rewrote this to
>
>
> : alloc_swap_scan_list() will scan the whole list or the first cluster.
> :
> : This reduces the repeat patterns of isolating a cluster then scanning that
> : cluster. As a result, cluster_alloc_swap_entry() is shorter and
> : shallower.
> :
> : No functional change.
>
> Which is hopefully accurate.
>
>
> LLMs do an awesome job of doing this, although one should carefully
> review the output. Here's gemini.google.com:
>
> : alloc_swap_scan_list() now scans either the entire list or just the
> : first cluster. This change eliminates the repetitive pattern of
> : isolating and then scanning a cluster. As a result, the function
> : cluster_alloc_swap_entry() is now shorter and less complex. There are
> : no functional changes to the code's behavior.
>
Thanks I will do a V3 and use something like that. I spot some other
minor cleanup required. Might just add it to the clean up series.

Chris