Re: [PATCH v5 01/11] mm, swap: add virtual swap device infrastructure

From: Rik van Riel

Date: Thu Sep 24 2026 - 14:40:50 EST


On Tue, 2026-09-22 at 23:18 -1000, Chris Li wrote:
> On Fri, Sep 18, 2026 at 1:03 PM Nhat Pham <nphamcs@xxxxxxxxx> wrote:
> >
> >
> > @@ -482,6 +491,11 @@ void swap_read_folio(struct swap_io_ctx *ctx,
> > struct folio *folio)
> >         if (zswap_load(folio) != -ENOENT)
> >                 goto finish;
> >
> > +       if (unlikely(swap_is_vswap(sis))) {
>
> There are too many swap_is_vswap() in this series. It fragments the
> code path, making things harder to reason about. Esepcially around
> locks. I count 22 in this patch alone.
>
> I consider this the biggest drawback of this series. This
> fragmentation of the code path.

Could we avoid that by simply always having everything
go through the vswap abstraction layer?

When everything in vswap, we don't need to test for it.

Handling the details of what's behind the vswap would
be handled one layer down.

Chris, do you think that would be cleaner?

What am I missing?

--
All Rights Reversed.