From: Nanzhe Zhao <zhaonanzhe@xiaomi.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Barry Song <baohua@kernel.org>,
linux-mm@kvack.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Minchan Kim <minchan@kernel.org>,
Kairui Song <kasong@tencent.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Nhat Pham <nphamcs@gmail.com>, Usama Arif <usama.arif@linux.dev>,
Yosry Ahmed <yosry@kernel.org>,
Chengming Zhou <chengming.zhou@linux.dev>,
Chris Li <chrisl@kernel.org>,
David Hildenbrand <david@kernel.org>,
Ying Huang <ying.huang@intel.com>,
Suren Baghdasaryan <surenb@google.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Kanchana P Sridhar <kanchana.p.sridhar@intel.com>,
Wajdi K Feghali <wajdi.k.feghali@intel.com>,
Bala Seshasayee <bala.seshasayee@linux.intel.com>,
Nick Terrell <terrelln@fb.com>,
Tangquan Zheng <zhengtangquan@oppo.com>,
Bo Zhang <zhangbo56@xiaomi.com>,
Nanzhe Zhao <zhaonanzhe@xiaomi.com>
Subject: [RFC PATCH v4 3/4] zram: backend_zstd: use multi-page size for zstd parameter setup
Date: Sun, 15 Nov 2026 10:44:50 +0800 [thread overview]
Message-ID: <20261115024455.1465726-4-zhaonanzhe@xiaomi.com> (raw)
In-Reply-To: <20261115024455.1465726-1-zhaonanzhe@xiaomi.com>
From: Barry Song <baohua@kernel.org>
zstd_setup_params() passes PAGE_SIZE to zstd_get_params() and
zstd_get_cparams() as the source size hint. When multi-page compression
is enabled, compressing 16 KiB blocks with 4 KiB-tuned parameters limits
zstd's match window to a single page and prevents it from finding
cross-page redundancy.
Pass ZCOMP_MULTI_PAGES_SIZE instead of PAGE_SIZE so that zstd configures
its parameters for the multi-page block size.
Signed-off-by: Barry Song <baohua@kernel.org>
Co-developed-by: Nanzhe Zhao <zhaonanzhe@xiaomi.com>
Signed-off-by: Nanzhe Zhao <zhaonanzhe@xiaomi.com>
---
drivers/block/zram/backend_zstd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/zram/backend_zstd.c b/drivers/block/zram/backend_zstd.c
index d55615f34300..9438691791ef 100644
--- a/drivers/block/zram/backend_zstd.c
+++ b/drivers/block/zram/backend_zstd.c
@@ -73,12 +73,12 @@ static int zstd_setup_params(struct zcomp_params *params)
goto error;
}
- zp->cprm = zstd_get_params(params->level, PAGE_SIZE);
+ zp->cprm = zstd_get_params(params->level, ZCOMP_MULTI_PAGES_SIZE);
zp->custom_mem.customAlloc = zstd_custom_alloc;
zp->custom_mem.customFree = zstd_custom_free;
- prm = zstd_get_cparams(params->level, PAGE_SIZE,
+ prm = zstd_get_cparams(params->level, ZCOMP_MULTI_PAGES_SIZE,
params->dict_sz);
if (!params->dict || !params->dict_sz)
--
2.43.0
next prev parent reply other threads:[~2026-11-15 2:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 2:44 [RFC PATCH v4 0/4] mTHP-friendly compression in zsmalloc and zram based on multi-pages Nanzhe Zhao
2026-11-15 2:44 ` [RFC PATCH v4 1/4] mm: zsmalloc: support objects compressed based on multiple pages Nanzhe Zhao
2026-11-15 2:44 ` [RFC PATCH v4 2/4] zram: support compression at the granularity of multi-pages Nanzhe Zhao
2026-11-15 2:44 ` Nanzhe Zhao [this message]
2026-11-15 2:44 ` [RFC PATCH v4 4/4] mm: swap: allow direct reclaim for synchronous multi-page swapin Nanzhe Zhao
2026-11-19 6:59 ` [syzbot ci] Re: mTHP-friendly compression in zsmalloc and zram based on multi-pages syzbot ci
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=20261115024455.1465726-4-zhaonanzhe@xiaomi.com \
--to=zhaonanzhe@xiaomi.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=bala.seshasayee@linux.intel.com \
--cc=baohua@kernel.org \
--cc=chengming.zhou@linux.dev \
--cc=chrisl@kernel.org \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kanchana.p.sridhar@intel.com \
--cc=kasong@tencent.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=ryan.roberts@arm.com \
--cc=senozhatsky@chromium.org \
--cc=surenb@google.com \
--cc=terrelln@fb.com \
--cc=usama.arif@linux.dev \
--cc=wajdi.k.feghali@intel.com \
--cc=ying.huang@intel.com \
--cc=yosry@kernel.org \
--cc=zhangbo56@xiaomi.com \
--cc=zhengtangquan@oppo.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
all inboxes | Powered by JetHome®