Re: [PATCH v2 0/3] mm: bypass swap readahead for zswap

From: Alexandre Ghiti

Date: Tue Sep 22 2026 - 04:08:38 EST


Hi,

I understand this series requires more review work than the simple
no-readahead for zswap. Let me know what you think and I can revert to
the simpler version.

Thanks for your time,

Alex

On Wed, Aug 19, 2026 at 3:21 PM Alexandre Ghiti <alexghiti@xxxxxxxx> wrote:
>
> Hi everyone,
>
> On Wed, Jul 22, 2026 at 6:35 PM Alexandre Ghiti <alex@xxxxxxxx> wrote:
> >
> > > >
> > First, the title is a bit misleading but this patchset is a follow-up of
> > the zswap bypass readahead, so I kept it.
> >
> > Swap readahead walks a window around the faulting entry and reads every
> > neighbour. Some of those reads are synchronous (a zswap-resident entry
> > or an entry on an SWP_SYNCHRONOUS_IO device) with no asynchronous device I/O
> > to overlap them with. Today they run inline during the window walk, so they
> > are pure added latency in front of the read the fault is actually waiting on.
> >
> > This series splits the window walk into two passes and reorders it around that
> > distinction:
> >
> > Patch 1 (overlap): issue the asynchronous device reads first, defer the
> > synchronous neighbours, and read them while the device I/O is in flight. This
> > overlaps the synchronous work with the disk reads instead of serialising it in
> > front of them -- the win for mixed (zswap + disk) workloads.
> >
> > Patch 2 (bypass unless the target needs I/O): when the faulting target is
> > itself synchronous there is no in-flight I/O to hide the second pass behind, so
> > skip it. This is the zswap readahead bypass, gated on the target: it helps
> > pure-zswap workloads and, above all, keeps synchronous-target page-fault
> > latency low.
> >
> > Patch 3 (SWP_SYNCHRONOUS_IO): treat SWP_SYNCHRONOUS_IO devices (zram) as
> > synchronous sources too, so a disk-target fault overlaps its zram neighbours'
> > reads behind its own disk I/O -- the same benefit patch 1 gives zswap
> > neighbours, now for mixed zram+disk workloads.
> >
>
> Let me know if I went too far with this new version or if you'd prefer
> something simpler. Or anything else you need, I'll be happy to come up
> with a new version.
>
> Thanks,
>
> Alex
>
> > Changes since the RFC [1]:
> > - patch 1: overlap the synchronous decompression with the in-flight disk I/O
> > - patch 2: bypass the second pass when the target needs no disk I/O
> > - patch 3: extend the same handling to SWP_SYNCHRONOUS_IO devices (zram)
> >
> > [1] https://lore.kernel.org/all/20260624075700.751467-1-alex@xxxxxxxx/
> >
> > Alexandre Ghiti (3):
> > mm: swap: overlap synchronous readahead decompression with disk I/O
> > mm: swap: bypass synchronous readahead unless the target needs I/O
> > mm: swap: treat SWP_SYNCHRONOUS_IO devices as synchronous in readahead
> >
> > include/linux/swap.h | 6 ++++
> > include/linux/zswap.h | 6 ++++
> > mm/swap_state.c | 67 +++++++++++++++++++++++++++++++++++++++++--
> > mm/swapfile.c | 11 +++++++
> > mm/zswap.c | 17 +++++++++++
> > 5 files changed, 105 insertions(+), 2 deletions(-)
> >
> >
> > base-commit: 13a1e1a618858407fa12c391f664ea750651f6b2
> > --
> > 2.53.0-Meta
> >
> >