From: Johannes Weiner <hannes@cmpxchg.org>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Nhat Pham <nphamcs@gmail.com>,
akpm@linux-foundation.org, cerasuolodomenico@gmail.com,
sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com,
mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com,
muchun.song@linux.dev, linux-mm@kvack.org, kernel-team@meta.com,
linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
Chris Li <chrisl@kernel.org>
Subject: Re: [PATCH v2 1/2] zswap: make shrinking memcg-aware
Date: Tue, 26 Sep 2023 14:24:36 -0400 [thread overview]
Message-ID: <20230926182436.GB348484@cmpxchg.org> (raw)
In-Reply-To: <CAJD7tkZqm9ZsAL0triwJPLYuN02jMMS-5Y8DE7TuDJVnOCm_7Q@mail.gmail.com>
On Mon, Sep 25, 2023 at 01:17:04PM -0700, Yosry Ahmed wrote:
> +Chris Li
>
> On Tue, Sep 19, 2023 at 10:14 AM Nhat Pham <nphamcs@gmail.com> wrote:
> >
> > From: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
> >
> > Currently, we only have a single global LRU for zswap. This makes it
> > impossible to perform worload-specific shrinking - an memcg cannot
> > determine which pages in the pool it owns, and often ends up writing
> > pages from other memcgs. This issue has been previously observed in
> > practice and mitigated by simply disabling memcg-initiated shrinking:
> >
> > https://lore.kernel.org/all/20230530232435.3097106-1-nphamcs@gmail.com/T/#u
> >
> > This patch fully resolves the issue by replacing the global zswap LRU
> > with memcg- and NUMA-specific LRUs, and modify the reclaim logic:
> >
> > a) When a store attempt hits an memcg limit, it now triggers a
> > synchronous reclaim attempt that, if successful, allows the new
> > hotter page to be accepted by zswap.
> > b) If the store attempt instead hits the global zswap limit, it will
> > trigger an asynchronous reclaim attempt, in which an memcg is
> > selected for reclaim in a round-robin-like fashion.
>
> Hey Nhat,
>
> I didn't take a very close look as I am currently swamped, but going
> through the patch I have some comments/questions below.
>
> I am not very familiar with list_lru, but it seems like the existing
> API derives the node and memcg from the list item itself. Seems like
> we can avoid a lot of changes if we allocate struct zswap_entry from
> the same node as the page, and account it to the same memcg. Would
> this be too much of a change or too strong of a restriction? It's a
> slab allocation and we will free memory on that node/memcg right
> after.
My 2c, but I kind of hate that assumption made by list_lru.
We ran into problems with it with the THP shrinker as well. That one
strings up 'struct page', and virt_to_page(page) results in really fun
to debug issues.
IMO it would be less error prone to have memcg and nid as part of the
regular list_lru_add() function signature. And then have an explicit
list_lru_add_obj() that does a documented memcg lookup.
Because of the overhead, we've been selective about the memory we
charge. I'd hesitate to do it just to work around list_lru.
next prev parent reply other threads:[~2023-09-26 18:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-19 17:14 [PATCH v2 0/2] workload-specific and memory pressure-driven zswap writeback Nhat Pham
2023-09-19 17:14 ` [PATCH v2 1/2] zswap: make shrinking memcg-aware Nhat Pham
2023-09-25 20:17 ` Yosry Ahmed
2023-09-26 18:24 ` Johannes Weiner [this message]
2023-09-26 18:37 ` Yosry Ahmed
2023-09-27 20:39 ` Johannes Weiner
2023-09-27 19:48 ` Domenico Cerasuolo
2023-09-27 20:28 ` Yosry Ahmed
2023-09-27 21:02 ` Johannes Weiner
2023-09-27 21:07 ` Yosry Ahmed
2023-09-27 20:51 ` Johannes Weiner
2023-09-27 20:57 ` Yosry Ahmed
2023-10-17 17:44 ` Ryan Roberts
2023-10-17 17:56 ` Domenico Cerasuolo
2023-10-17 18:25 ` Ryan Roberts
2023-09-19 17:14 ` [PATCH v2 2/2] zswap: shrinks zswap pool based on memory pressure Nhat Pham
2023-09-25 20:37 ` Yosry Ahmed
2023-09-25 23:29 ` Nhat Pham
2023-09-25 23:59 ` Yosry Ahmed
2023-09-26 0:43 ` Nhat Pham
2023-09-26 1:11 ` Yosry Ahmed
2023-09-27 23:42 ` Nhat Pham
2023-09-19 19:31 ` [PATCH v2 0/2] workload-specific and memory pressure-driven zswap writeback 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=20230926182436.GB348484@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=cerasuolodomenico@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=chrisl@kernel.org \
--cc=ddstreet@ieee.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=nphamcs@gmail.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@google.com \
--cc=sjenning@redhat.com \
--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