mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Barry Song <baohua@kernel.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	 Chris Wiseman <chriswiseman@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Minchan Kim <minchan@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	 Yosry Ahmed <yosry@kernel.org>, Nhat Pham <nphamcs@gmail.com>,
	 Chengming Zhou <chengming.zhou@linux.dev>,
	Xueyuan Chen <xueyuan.chen21@gmail.com>,
	 Xueyuan Chen <xueyuan.chen@vivo.com>,
	Brian Geffon <bgeffon@google.com>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	Nanzhe Zhao <nzzhao@126.com>
Subject: Re: [PATCH] mm/zsmalloc: remove shrinker
Date: Thu, 3 Dec 2026 12:37:06 +0900	[thread overview]
Message-ID: <axDhwDyXvP7jRmoP@google.com> (raw)
In-Reply-To: <CAGsJ_4yoogQHpxGigawTfMPEKL_A6OkfEfsmJHzDHLPS3FCUQg@mail.gmail.com>

On (26/12/03 11:24), Barry Song wrote:
[..]
> > I suppose compaction will be beneficial after a huge app swap-in, e.g.
> > bringing back a web browser with (usual) million tabs.  Or after a huge
> > app kill/termination, if the app had swap presence.  Both of these
> > release memory from zsmalloc and create fragmentation, so we might
> > benefit from doing a de-fragmentation.
> 
> Right. I had Nanzhe(Cc-ed) test this patch on Pixel 6 phones by repeatedly
> launching apps in a loop. We observed some negative results with
> this patch in the absence of proactive compaction.
> 
> Nanzhe collected the time series of (mem_used_total - compr_data_size).
> Without the patch, the median was 32 MB. With the patch, it increased
> to 182 MB, peaking at 622 MB.
> 
> The median memory overhead due to fragmentation increased from
> 2.5% without the patch to 16.87% with the patch.

Hmm that's a high number...

> So it seems that while mid-swap compaction is undesirable from a
> performance perspective, it does help reduce the memory footprint
> on phones.

A bit of problem is that you need memory pressure to trigger compaction.
On a device, which does proactive per-app swap outs w/o hitting memory
pressure, the fragmentation footprint just sits there (and maybe even
grows).

I wonder if we should consider some sort of a background compaction
triggered by zram instead of shrinker callback.  E.g. when zram observes
that mem_used_total to compr_data_size ration goes above some run-time
configurable threshold (e.g. 5%).

  reply	other threads:[~2026-12-03  3:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 15:02 Chris Wiseman
2026-12-01 16:45 ` Nhat Pham
2026-12-01 16:53 ` Yosry Ahmed
2026-12-02  0:46 ` Xueyuan Chen
2026-12-02  2:09 ` Sergey Senozhatsky
2026-12-02  7:04 ` Barry Song
2026-12-02  8:14   ` Sergey Senozhatsky
2026-12-02 10:21     ` Barry Song
2026-12-03  3:08       ` Sergey Senozhatsky
2026-12-03  3:24         ` Barry Song
2026-12-03  3:37           ` Sergey Senozhatsky [this message]
2026-12-03  4:24             ` Sergey Senozhatsky
2026-12-03  4:42               ` Chris Wiseman
2026-12-03  4:58                 ` Sergey Senozhatsky
2026-12-03 10:17                   ` Sergey Senozhatsky
2026-12-03  4:52               ` Sergey Senozhatsky
2026-12-03  5:10                 ` Barry Song
2026-12-03  6:17                   ` 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=axDhwDyXvP7jRmoP@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=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=nzzhao@126.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®