Re: [PATCH v3] erofs: cap LZMA stream pool size
From: Uwe Kleine-König
Date: Mon Aug 03 2026 - 05:17:22 EST
Hello,
On Mon, Aug 03, 2026 at 10:09:06AM +0200, Geert Uytterhoeven wrote:
> On Tue, 28 Jul 2026 at 08:55, SJ Park <sj@xxxxxxxxxx> wrote:
> > I don't have a m68k testfarm, either. I'm doing crossbuild [1]. Hopefully you
> > could also reproduce it.
FTR, I don't have m68k hardware either, but as this is a build time
failure installing the Debian package gcc-m68k-linux-gnu and then doing
builds using
make ARCH=m68k CROSS_COMPILE=m68k-linux-gnu-
is good enough to reproduce the failure.
> I think you can reproduce some of the issues on most architectures
> with a non-SMP kernel, cfr. my reply[1] to Uwe's proposed fix.
> Unfortunately the Kconfig warning only shows up on architectures that
> don't define NR_CPUS (because they do not support SMP) at all,
> while ending up with zero streams is probably a runtime failure.
>
> [1] https://lore.kernel.org/CAMuHMdVGKX=3cfOrLWp1uSHX76xf1-=C0+GVCXkA8JTqNPg-ew@xxxxxxxxxxxxxx
I guess EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS should depend on SMP and
it's use should be conditionalized using something like
diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c
index 6b0cdb446c6a..c00e94f8206f 100644
--- a/fs/erofs/decompressor_lzma.c
+++ b/fs/erofs/decompressor_lzma.c
@@ -50,9 +50,13 @@ static int __init z_erofs_lzma_init(void)
unsigned int i;
/* by default, use # of possible CPUs instead */
- if (!z_erofs_lzma_nstrms)
- z_erofs_lzma_nstrms = min_t(unsigned int, num_possible_cpus(),
- CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS);
+ if (!z_erofs_lzma_nstrms) {
+ if (IS_ENABLED(CONFIG_SMP))
+ z_erofs_lzma_nstrms = min_t(unsigned int, num_possible_cpus(),
+ CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS);
+ else
+ z_erofs_lzma_nstrms = 1;
+ }
for (i = 0; i < z_erofs_lzma_nstrms; ++i) {
struct z_erofs_lzma *strm = kzalloc_obj(*strm);
I played a bit with the definition of
EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS in fs/erofs/Kconfig, but didn't
find a way to define it that both uses NR_CPUS and doesn't generate a
warning with ARCH=m68k.
Best regards
Uwe
Attachment:
signature.asc
Description: PGP signature