mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/1] erofs: fix unused pcluster_pools for higher page sizes
@ 2026-08-16 13:07 Ojaswin Mujoo
  2026-08-16 13:07 ` [PATCH 1/1] " Ojaswin Mujoo
  0 siblings, 1 reply; 4+ messages in thread
From: Ojaswin Mujoo @ 2026-08-16 13:07 UTC (permalink / raw)
  To: linux-erofs
  Cc: Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Sandeep Dhavale,
	Hongbo Li, Chunhai Guo, linux-kernel

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 <xiang@kernel.org>
  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(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-17  8:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-16 13:07 [PATCH 0/1] erofs: fix unused pcluster_pools for higher page sizes Ojaswin Mujoo
2026-08-16 13:07 ` [PATCH 1/1] " Ojaswin Mujoo
2026-08-17  1:34   ` Gao Xiang
2026-08-17  8:54   ` Chao Yu

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®