mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ojaswin Mujoo <ojaswin@linux.ibm.com>
To: linux-erofs@lists.ozlabs.org
Cc: Gao Xiang <xiang@kernel.org>, Chao Yu <chao@kernel.org>,
	Yue Hu <zbestahu@gmail.com>,
	Jeffle Xu <jefflexu@linux.alibaba.com>,
	Sandeep Dhavale <dhavale@google.com>,
	Hongbo Li <hongbohbli@tencent.com>,
	Chunhai Guo <guochunhai@vivo.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 0/1] erofs: fix unused pcluster_pools for higher page sizes
Date: Sun, 16 Aug 2026 18:37:08 +0530	[thread overview]
Message-ID: <cover.1786884312.git.ojaswin@linux.ibm.com> (raw)

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


             reply	other threads:[~2026-08-16 13:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16 13:07 Ojaswin Mujoo [this message]
2026-08-16 13:07 ` [PATCH 1/1] " Ojaswin Mujoo
2026-08-17  1:34   ` Gao Xiang
2026-08-17  8:54   ` Chao Yu

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=cover.1786884312.git.ojaswin@linux.ibm.com \
    --to=ojaswin@linux.ibm.com \
    --cc=chao@kernel.org \
    --cc=dhavale@google.com \
    --cc=guochunhai@vivo.com \
    --cc=hongbohbli@tencent.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiang@kernel.org \
    --cc=zbestahu@gmail.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®