mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Xueyuan Chen <xueyuan.chen21@gmail.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Yosry Ahmed <yosry@kernel.org>, Nhat Pham <nphamcs@gmail.com>,
	 Barry Song <baohua@kernel.org>,
	Brian Geffon <bgeffon@google.com>,
	 Minchan Kim <minchan@kernel.org>,
	Richard Chang <richardycc@google.com>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Chengming Zhou <chengming.zhou@linux.dev>,
	 Xueyuan Chen <xueyuan.chen@vivo.com>,
	Nanzhe Zhao <nzzhao@126.com>,
	linux-kernel@vger.kernel.org,  linux-block@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [RFC PATCH 0/4] zsmalloc: replace shrinker with deferred compaction
Date: Fri, 4 Dec 2026 12:49:07 +0900	[thread overview]
Message-ID: <axI3n-HQ6vKxRmII@google.com> (raw)
In-Reply-To: <179635291992.1911544.5833379956441668587.b4-reply@b4>

On (26/12/04 10:55), Xueyuan Chen wrote:
> On 2026-12-03 19:13 +0900, Sergey Senozhatsky wrote:
> > This is a follow-up to Chris's shrinker removal patch [1] and Barry's
> > Pixel 6 fragmentation numbers [2].
> > 
> > Removing the shrinker avoids mid-swap compaction stalls, but without
> > any automatic compaction we risk regressing memory footprint on systems
> > that do not run a userspace compaction daemon, and on systems that do
> > proactive swap-out without hitting memory pressure (no shrinker
> > triggers).
> > 
> > Replace shrinker callbacks (now removed) with deferred threshold-based
> > compaction in zsmalloc (plus a runtime-tunable zram sysfs knob to
> > configure or disable it).
> 
> Hi Sergey,
> 
> I wonder if we could also consider cross-class reuse to reduce the
> need for compaction.
> 
> In my Pixel 6 Pro workload, I observed that the 2048-byte class
> grew by 3.5 MiB within a 2-second window while other size classes
> had about 125 MiB of compactable memory.
> 
> When a class runs out of free objects, could we try allocating from
> an existing zspage in a slightly larger class before allocating
> a new zspage?
> 
> This would introduce some internal fragmentation, but might reduce
> physical page allocations and object migration during compaction,
> without changing the existing zspage layout or the allocation fast
> path.
> 
> What do you think about this trade-off?

That idea did pop-up sometime in 2015-2017, but we were never sure
about it.  Borrowing free space from a higher size class comes with
higher object padding overhead, potentially, so we never explored
it in depth.  This kind of changes zsmalloc design, from being slab-like
to managing free spaces.

  reply	other threads:[~2026-12-04  3:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 10:13 Sergey Senozhatsky
2026-12-03 10:13 ` [RFC PATCH 1/4] mm/zsmalloc: remove shrinker Sergey Senozhatsky
2026-12-03 10:13 ` [RFC PATCH 2/4] zsmalloc: introduce lockless zs_class_can_compact() Sergey Senozhatsky
2026-12-03 10:13 ` [RFC PATCH 3/4] zsmalloc: add deferred threshold compaction Sergey Senozhatsky
2026-12-03 10:13 ` [RFC PATCH 4/4] zram: add compact_threshold sysfs attribute Sergey Senozhatsky
2026-12-04  2:55 ` [RFC PATCH 0/4] zsmalloc: replace shrinker with deferred compaction Xueyuan Chen
2026-12-04  3:49   ` Sergey Senozhatsky [this message]
2026-12-04  3:51 ` 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=axI3n-HQ6vKxRmII@google.com \
    --to=senozhatsky@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=bgeffon@google.com \
    --cc=chengming.zhou@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=nphamcs@gmail.com \
    --cc=nzzhao@126.com \
    --cc=richardycc@google.com \
    --cc=xueyuan.chen21@gmail.com \
    --cc=xueyuan.chen@vivo.com \
    --cc=yosry@kernel.org \
    /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®