From: Xueyuan Chen <xueyuan.chen21@gmail.com>
To: Nhat Pham <nphamcs@gmail.com>
Cc: Chris Wiseman <chriswiseman@google.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Xueyuan Chen <xueyuan.chen@vivo.com>,
Barry Song <baohua@kernel.org>,
Yosry Ahmed <yosry.ahmed@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>,
Brian Geffon <bgeffon@google.com>,
Minchan Kim <minchan@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
xueyuan.chen21@gmail.com
Subject: Re: [RFC PATCH 0/2] mm: zsmalloc: make shrinker compaction budget-aware
Date: Thu, 05 Nov 2026 09:10:24 +0800 [thread overview]
Message-ID: <179384102494.19062.12740032892044628762.b4-reply@b4> (raw)
In-Reply-To: <CAKEwX=PFdgEbba+H3fEnJFDnfkxCTsvuHEb4numVwJRaiMgwKQ@mail.gmail.com>
On 2026-11-04 14:54 -0700, Nhat Pham wrote:
> On Wed, Nov 4, 2026 at 11:46 AM Chris Wiseman <chriswiseman@google.com> wrote:
> >
> > On Wed, Nov 4, 2026 at 9:57 AM Nhat Pham <nphamcs@gmail.com> wrote:
> > >
> > > Is this precheck basically checking if we can free at least one zspage
> > > of the size class before proceeding? Yeah the number looks good -
> > > let's add that, in parallel!
> >
> > Yeah, it just checks if a bucket has enough wasted slots to free at
> > least one full page before taking the locks. Sergey pointed out those
>
> You meant full zspage here right? IIUC we keep the entire chain of
> zpages around until the entire zspage is gone?
>
> > two counters aren't atomic together so an unlocked check is just a
> > best-effort hint - if you and Sergey are good with that, happy to send a
> > patch.
>
> Personally I'm happy with it being a best-effort hint!
>
> We can also recheck after we acquire the lock (but I suspect it's
> unlikely we'll get radically different decision?)
>
> Sergey, how do you feel about this?
>
> >
> > > Ah ok hmm. Sounds like internal compaction isn't that helpful, i.e
> > > zsmalloc already does a pretty decent job at packing objects that
> > > there aren't a terrible amount of internal fragmentation in the first
> > > place...?
> > > Should we do CONFIG_ZSMALLOC_SHRINKER (default to N or to
> > > CONFIG_ZSWAP) for now, and remove it in a couple of releases if users
> > > in the wild do not complain?
> >
> > Compaction still helps when we trigger it between bursts (freed ~21 MB
> > before the swap storm and ~10 MB after). It just wastes time running
> > mid-swap when new writes are filling those open slots right back up.
> > Defaulting CONFIG_ZSMALLOC_SHRINKER to N (or CONFIG_ZSWAP) for a couple
> > releases makes sense to me.
>
Hi Nhat, Chris,
> SGTM, but I'll let Sergey chime in!
Thanks, Nhat and Chris, for the discussion.
If Sergey has no objections, I'd be happy to send a follow-up series
to make the shrinker configurable and add the unlocked pre-check as
Nhat suggested.
next prev parent reply other threads:[~2026-11-05 1:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1786003779.git.xueyuan.chen@vivo.com>
2026-08-07 3:56 ` Sergey Senozhatsky
2026-08-07 10:57 ` Xueyuan Chen
2026-08-07 12:12 ` Sergey Senozhatsky
2026-08-07 16:25 ` Nhat Pham
2026-08-11 9:03 ` Xueyuan Chen
2026-08-11 16:25 ` Nhat Pham
2026-08-14 16:50 ` Xueyuan Chen
2026-08-18 12:11 ` Xueyuan Chen
2026-10-29 1:43 ` Sergey Senozhatsky
2026-10-29 1:48 ` Sergey Senozhatsky
2026-11-02 2:58 ` Xueyuan Chen
2026-11-04 18:06 ` Nhat Pham
2026-10-30 2:05 ` Xueyuan Chen
2026-10-29 2:26 ` Sergey Senozhatsky
2026-11-01 23:47 ` Sergey Senozhatsky
2026-11-02 20:24 ` Chris Wiseman
2026-11-04 17:57 ` Nhat Pham
2026-11-04 18:46 ` Chris Wiseman
2026-11-04 21:54 ` Nhat Pham
2026-11-05 1:10 ` Xueyuan Chen [this message]
2026-11-05 5:05 ` Sergey Senozhatsky
2026-11-05 13:36 ` Chris Wiseman
2026-11-05 15:08 ` Nhat Pham
2026-11-05 15:32 ` Xueyuan Chen
2026-11-05 15:38 ` Yosry Ahmed
2026-11-05 15:39 ` Yosry Ahmed
2026-11-05 15:24 ` Xueyuan Chen
2026-11-05 5:01 ` Sergey Senozhatsky
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=179384102494.19062.12740032892044628762.b4-reply@b4 \
--to=xueyuan.chen21@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=bgeffon@google.com \
--cc=chriswiseman@google.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=nphamcs@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=xueyuan.chen@vivo.com \
--cc=yosry.ahmed@linux.dev \
/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
all inboxes | Powered by JetHome®