From: Nhat Pham <nphamcs@gmail.com>
To: Chris Li <chrisl@kernel.org>
Cc: Yosry Ahmed <yosryahmed@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
tj@kernel.org, lizefan.x@bytedance.com,
Johannes Weiner <hannes@cmpxchg.org>,
Domenico Cerasuolo <cerasuolodomenico@gmail.com>,
Seth Jennings <sjenning@redhat.com>,
Dan Streetman <ddstreet@ieee.org>,
Vitaly Wool <vitaly.wool@konsulko.com>,
mhocko@kernel.org, roman.gushchin@linux.dev,
Shakeel Butt <shakeelb@google.com>,
muchun.song@linux.dev, Hugh Dickins <hughd@google.com>,
corbet@lwn.net, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
senozhatsky@chromium.org, rppt@kernel.org,
linux-mm <linux-mm@kvack.org>,
kernel-team@meta.com, LKML <linux-kernel@vger.kernel.org>,
linux-doc@vger.kernel.org, david@ixit.cz
Subject: Re: [PATCH v5] zswap: memcontrol: implement zswap writeback disabling
Date: Sun, 19 Nov 2023 11:08:40 -0800 [thread overview]
Message-ID: <CAKEwX=NdFjemcmf27PVpgHpVHWQEo19KfApepWJBRYeyVCWvCw@mail.gmail.com> (raw)
In-Reply-To: <CAF8kJuOD6zq2VPcVdoZGvkzYX8iXn1akuYhNDJx-LUdS+Sx3GA@mail.gmail.com>
On Sun, Nov 19, 2023 at 1:39 AM Chris Li <chrisl@kernel.org> wrote:
>
> On Sat, Nov 18, 2023 at 11:23 AM Nhat Pham <nphamcs@gmail.com> wrote:
> >
> > Hmm how about this - in the future, we support the following
> > options:
> >
> > 1. zswap.writeback == 1: no limitation to zswap writeback.
> > All backing swap devices (sorted by priorities?) are fair game.
> >
> > 2. zswap.writeback == 0: disable all forms of zswap writeback.
> >
> > 3. zswap.writeback == <tiers description>: attempt to write to each
> > tier, one at a time.
>
> We can merge the zswap.writeback as it is for now to unblock you.
>
> For the future. I think we should remove zswap.writeback completely.
I'm a bit weary about API changes, especially changes that affect
backward compatibility. Breaking existing userspace programs simply
with a kernel upgrade does not sound very nice to me.
(although I've heard that the eventual plan is to deprecate cgroupv1
- not sure how that is gonna proceed).
Hence my attempt at creating something that can both serve the
current use case, while still remaining (fairly) extensible for future
ideas.
>
> Instead we have:
>
> swap.tiers == <swap_tier_list_name>
> swap.tiers == "all" all available swap tiers. "zswap + swap file".
> This is the default.
> swap.tiers == "zswap" zswap only, no other swap file. Internally set
> zswap.writeback = 0
> swap.tiers == "foo" foo is a list of swap devices it can use. You can
> define your town custom swap tier list in
> swap.tiers == "none" or "disabled" Not allowed to swap.
swap.tiers == "none" or "disabled" means disallowing zswap as
well, correct?
>
> "all", "zswap", "none" are reserved keywords.
> "foo", "bar" etc are custom lists of swap tiers. User define custom
> tier list in sys/kernel/mm/swap/tiers:
> ssd:zswap,/dev/nvme01p4
> hdd:/dev/sda4,/dev/sdb4
I don't have any major argument against this. It just seems a bit
heavyweight for what we need at the moment (only disabling
swap-to-disk usage).
I'll let other people weigh in about this of course.
Johannes, how do you feel about this proposed API?
>
> That would define two custom tiers. "ssd" can use zswap then /dev/nvme01p4.
> The exact name of the "swap.tiers" and tiers name are open to suggestions.
>
> >
> > The first two are basically what we have for this patch.
> > The last one will be added in a future patch.
> >
> > This is from the userspace perspective. Internally, we can modify
> > memcg->writeback to be a pointer or a struct instead of this bool.
> > (as you suggested).
>
> Internally I would suggest memcg->swaptiers, the write back name is
> somewhat confusing. As your patch indicated. It has two situation:
> 1. shrinking from zpool to real swapfile. The write back is appropriate here.
> 2. zswap store failed (compression ratio too low, out of memory etc).
> The write back is confusing here. It is more like writing through or
> skip.
>
> >
> > This way, the API remains intact and backward compatible
> > (and FWIW, I think there are still a lot of values in having simple
> > options for the users who have simple memory hierarchies).
>
> swap.tiers can be simple. For example, you can modify your patch to
> "swap.tires == zswap" to
> set zswap.writeback bool to 0 for now. Most of your patch is still re-usable.
>
I'm less concerned about internals - that is always up to changes.
I'm a bit more concerned with the API we're exposing to the users.
> I think we should discuss if we want to keep zswap.writeback in the
> future because that would be some code undeletable and functionally
> overlap with swap.tiers
This is a fair point.
>
> Chris
next prev parent reply other threads:[~2023-11-19 19:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-15 17:23 Nhat Pham
2023-11-16 20:53 ` Chris Li
2023-11-16 21:00 ` Yosry Ahmed
2023-11-17 0:39 ` Chris Li
2023-11-18 19:23 ` Nhat Pham
2023-11-19 9:39 ` Chris Li
2023-11-19 19:08 ` Nhat Pham [this message]
2023-11-19 21:50 ` Chris Li
2023-11-20 2:41 ` Chris Li
2023-11-21 18:13 ` Nhat Pham
2023-11-21 19:08 ` Chris Li
2023-11-22 1:19 ` Nhat Pham
2023-11-22 3:45 ` Chris Li
2023-11-22 15:01 ` Chris Li
2023-12-06 18:15 ` Nhat Pham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKEwX=NdFjemcmf27PVpgHpVHWQEo19KfApepWJBRYeyVCWvCw@mail.gmail.com' \
--to=nphamcs@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cerasuolodomenico@gmail.com \
--cc=chrisl@kernel.org \
--cc=corbet@lwn.net \
--cc=david@ixit.cz \
--cc=ddstreet@ieee.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=kernel-team@meta.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizefan.x@bytedance.com \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=rppt@kernel.org \
--cc=senozhatsky@chromium.org \
--cc=shakeelb@google.com \
--cc=sjenning@redhat.com \
--cc=tj@kernel.org \
--cc=vitaly.wool@konsulko.com \
--cc=yosryahmed@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox