Re: [PATCH v4 12/19] mm, swap: use swap cache as the swap in synchronize layer

Kairui Song
2025-12-18T03:41:30Z

On Thu, Dec 18, 2025 at 11:32 AM Baoquan He <bhe@redhat.com> wrote:
>
> On 12/05/25 at 03:29am, Kairui Song wrote:
> > From: Kairui Song <kasong@tencent.com>
> >
> > Current swap in synchronization mostly uses the swap_map's
> > SWAP_HAS_CACHE bit. Whoever sets the bit first does the actual
> > work to swap in a folio.
> >
> > This has been causing many issues as it's just a poor implementation
> > of a bit lock. Raced users have no idea what is pinning a slot, so
> > it has to loop with a schedule_timeout_uninterruptible(1), which is
> > ugly and causes long-tailing or other performance issues. Besides,
> > the abuse of SWAP_HAS_CACHE has been causing many other troubles for
> > synchronization or maintenance.
> >
> > This is the first step to remove this bit completely.
> >
> > We have just removed all swap in paths that bypass the swap cache, and
>
> I think we didn't remove swap in paths that bypss the swap cache, we
> just add folio to swap cache in those swap in paths where swap cache is
> bypassed.
>

Hmm, that sounds exactly like we removed the "swap cache bypass" thing :)

Anyway I can change the word here to make it read better.