Re: [PATCH v3] erofs: cap LZMA stream pool size
Geert Uytterhoeven <[email protected]>
| Newsgroups | org.ozlabs.lists.linux-erofs,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAMuHMdXUyAX0TV0Sq9_YxvipzkVOBX=4s_r5mVQcZ_7nL=-AQw@mail.gmail.com> |
On Mon, 3 Aug 2026 at 11:12, Uwe Kleine-König <[email protected]> wrote: > On Mon, Aug 03, 2026 at 10:09:06AM +0200, Geert Uytterhoeven wrote: > > On Tue, 28 Jul 2026 at 08:55, SJ Park <[email protected]> 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@mail.gmail.com > > 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); LGTM. > > 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. Any progress with fixing this for v7.2? NR_CPUS depends on SMP on most architectures, so you get e.g. with ARCH=arm allmodconfig + CONFIG_SMP=n: CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=0 X86 defines NR_CPUS unconditionally, so there it works as expected. Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds