erofs: fix unused pcluster_pools for higher page sizes
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest1 patch 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | erofs: fix unused pcluster_pools for higher page sizesfs/ | +11 | 2 replies |
Reviews trailers per patch
The patch has a Reviewed-by or Acked-by.
| Patch | Gao Xiang | Chao Yu |
|---|---|---|
| 1/1 | R-b | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/1] erofs: fix unused pcluster_pools for higher page sizes
When inserting the erofs module on an older kernel with a 64K page size machine, we were running into the following dmesg followed by a stack dump (Needs, CONFIG_DEBUG_VM=y):
[ 4.616501] kmem_cache of name 'erofs_pcluster-16' already exists
The root cause is that on 64k page size:
Z_EROFS_PCLUSTER_MAX_PAGES = 1M / 16k = 16
and, on that kernel, our logic to create the pcluster pool is as:
static struct z_erofs_pcluster_slab pcluster_pool[] __read_mostly = {
_PCLP(1), _PCLP(4), _PCLP(16), _PCLP(64), _PCLP(128),
_PCLP(Z_EROFS_PCLUSTER_MAX_PAGES)
};so we were ending up creating kmemcaches for nr_pages= 1, 4, 16, 64, 128, and Z_EROFS_PCLUSTER_MAX_PAGES (=16, again). This caused the kmem_cache sanity check to emit the warning.
When comparing with the upstream code, I noticed that this issue has been fixed as a side effect of the patch:
commit 7361d1e3763baaf7b9349c576137851458ad38d1
Author: Gao Xiang <[email protected]>
Date: Mon Mar 10 17:54:59 2025 +0800
erofs: support unaligned encoded data
which changes
static struct z_erofs_pcluster_slab pcluster_pool[] __read_mostly = {
_PCLP(1), _PCLP(4), _PCLP(16), _PCLP(64), _PCLP(128), - _PCLP(Z_EROFS_PCLUSTER_MAX_PAGES)
+ _PCLP(Z_EROFS_PCLUSTER_MAX_PAGES + 1)
};
and hence the final cache has nr_pages = 17 and doesn't clash with the nr_pages=16 cache anymore. However, this is still incorrect as on higher page sizes like 64k we will never use nr_pages > 16 and the rest of the caches are wasted.
So this patch intends to fix the issue on upstream first and if the approach looks okay, I'll send a backport for other the older affected kernels.
Regards,
ojaswin
Ojaswin Mujoo (1):
erofs: fix unused pcluster_pools for higher page sizes
fs/erofs/zdata.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
Signature · 1 line
2.55.0