From: Hongfeng Chen <chenhongfeng0212@163.com>
To: Nhat Pham <nphamcs@gmail.com>
Cc: Hongfeng Chen <chenhongfeng0212@163.com>,
Andrew Morton <akpm@linux-foundation.org>,
Barry Song <baohua@kernel.org>,
Chengming Zhou <chengming.zhou@linux.dev>,
Jens Axboe <axboe@kernel.dk>,
Johannes Weiner <hannes@cmpxchg.org>,
Minchan Kim <minchan@kernel.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Yosry Ahmed <yosry@kernel.org>,
Wenchao Hao <haowenchao@xiaomi.com>,
Wenchao Hao <haowenchao22@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-block@vger.kernel.org,
Hongfeng Chen <hongfengchen@xiaomi.com>,
Hongfeng Chen <chenhongfeng0212@gmail.com>
Subject: Re: [RFC PATCH v4 0/2] mm/zsmalloc: defer object free to per-cpu batches
Date: Fri, 23 Oct 2026 20:37:36 +0800 [thread overview]
Message-ID: <20261023123736.1542117-1-chenhongfeng0212@163.com> (raw)
In-Reply-To: <CAKEwX=ONniSwdiZAe_8NT5XwVj=Mmc-WJs_rWE4Y5snjFg2=Eg@mail.gmail.com>
Hi Nhat,
On Fri, Oct 16, 2026 at 9:09 AM Nhat Pham <nphamcs@gmail.com> wrote:
> 1. Would memory freeing be slowed down?
I sampled pool->pages_allocated every 1 ms, and measured the time from
the start of munmap() until the zspages are freed. Three cases are
tested: 1 process x 256MB, 1 process x 1024MB, and 4 processes x
256MB. The results are as follows:
workload base with-patch
1 process, 256 MB 14 ms 9 ms
1 process, 1024 MB 51 ms 31 ms
4 processes, 256 MB 45 ms 24 ms
Memory freeing didn't get slower and it actually got faster.
> 2. Would this introduce isolation issues, especially when this work is
> not properly accounted?
Yes. The drain runs in an unbound kworker in the root cgroup, so its
cost is not charged to the killed tenant, and it may take CPU time
from other tenants. I'd appreciate any suggestions on a clean way to
handle this.
> Another thing I wonder is, how much of this slowed down is because of
> zsmalloc's own inefficiency, and how much is because we just have a
> larger logical footprint
Mostly zsmalloc. I kept the footprint the same (1 GB paged out to zram,
then munmap()) and only made zs_free() do nothing:
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1455,6 +1455,8 @@ void zs_free(struct zs_pool *pool, unsigned long handle)
int fullness;
struct zspage *zspage_to_free = NULL;
+ return;
+
if (IS_ERR_OR_NULL((void *)handle))
return;
The speedup is as follows:
machine base with-diff-above speedup
x86, 1024 MB 50.2 ms 20.6 ms 2.44x
RK3588 A76, 1024 MB 89.4 ms 23.3 ms 3.84x
Thanks,
Hongfeng
next prev parent reply other threads:[~2026-10-23 12:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 12:09 Hongfeng Chen
2026-10-16 12:09 ` [RFC PATCH v4 1/2] mm/zsmalloc: defer object free to per-cpu batches and a drain worker Hongfeng Chen
2026-10-16 16:09 ` [RFC PATCH v4 0/2] mm/zsmalloc: defer object free to per-cpu batches Nhat Pham
2026-10-22 2:55 ` Sergey Senozhatsky
2026-10-23 12:37 ` Hongfeng Chen [this message]
2026-10-23 18:19 ` Nhat Pham
2026-10-17 3:15 ` [RFC PATCH v4 2/2] zram: keep the hot statistics per cpu Hongfeng Chen
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=20261023123736.1542117-1-chenhongfeng0212@163.com \
--to=chenhongfeng0212@163.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=baohua@kernel.org \
--cc=chengming.zhou@linux.dev \
--cc=chenhongfeng0212@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=haowenchao22@gmail.com \
--cc=haowenchao@xiaomi.com \
--cc=hongfengchen@xiaomi.com \
--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=senozhatsky@chromium.org \
--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®