Re: [RFC PATCH] memcontrol: implement swap bypassing

From: Yosry Ahmed
Date: Mon Oct 30 2023 - 14:11:23 EST


On Fri, Oct 27, 2023 at 1:27 PM Nhat Pham <nphamcs@xxxxxxxxx> wrote:
>
> On Tue, Oct 24, 2023 at 7:09 PM Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
> >
> > On Tue, Oct 24, 2023 at 4:35 PM Nhat Pham <nphamcs@xxxxxxxxx> wrote:
> > >
> > > During our experiment with zswap, we sometimes observe swap IOs due to
> > > occasional zswap store failures and writebacks. These swapping IOs
> > > prevent many users who cannot tolerate swapping from adopting zswap to
> > > save memory and improve performance where possible.
> > >
> > > This patch adds the option to bypass swap entirely: do not swap when an
> > > zswap store attempt fail, and do not write pages in the zswap pool back
> > > to swap. The feature is disabled by default (to preserve the existing
> > > behavior), and can be enabled on a cgroup-basis via a new cgroup file.
> >
> > I think the word "bypass" here is fairly confusing because zswap is
> > considered as swap for all purposes, so we are not really bypassing
> > swap. I think it should be something like memory.swap.disk or
> > memory.swap.writeback or whatever the correct terminology is for
> > non-zswap swap (which I honestly don't know). Writing 0 to such an
> > interface would give the desired effect.
>
> I'm honestly not very good at naming things... especially a novel
> name that I cannot steal from a precedent...

Neither am I :)

>
> I want something that means "going to zswap is acceptable, but please
> don't go to slow swap". Hence, swap bypassing (swap in my mental
> model is the slow thing that is under zswap).
>
> (but I imagined memory.please.don't.go.to.slow.swap won't be very
> popular either...)
>
> memory.swap.disk is... acceptable, I guess? It technically could still be
> wrong, as there's still zram, but we can sort of ignore that special case.
> I still prefer memory.swap.bypass, but I wouldn't be opposed to this
> renaming.
>
> Anyone with better naming suggestions should absolutely speak up!
> Otherwise, I'll send a v2 renaming this to "memory.swap.disk" or
> "memory.swap.disk_used"
>

Hoping someone else chimes in for the naming here, this is not going
to be changeable anytime soon.