Re: [PATCH v3] erofs: cap LZMA stream pool size
Uwe Kleine-König <[email protected]> Mon, 3 Aug 2026 11:12:49 +0200
| Newsgroups | org.ozlabs.lists.linux-erofs,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <anBYnPELPotUiNjv@monoceros> |
--sfor6dhu35gfvxc4 Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH v3] erofs: cap LZMA stream pool size MIME-Version: 1.0 Hello, 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]. Hopef= ully 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=3Dm68k CROSS_COMPILE=3Dm68k-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. >=20 > [1] https://lore.kernel.org/CAMuHMdVGKX=3D3cfOrLWp1uSHX76xf1-=3DC0+GVCXkA= [email protected] 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; =20 /* by default, use # of possible CPUs instead */ - if (!z_erofs_lzma_nstrms) - z_erofs_lzma_nstrms =3D 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 =3D min_t(unsigned int, num_possible_cpus(), + CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS); + else + z_erofs_lzma_nstrms =3D 1; + } =20 for (i =3D 0; i < z_erofs_lzma_nstrms; ++i) { struct z_erofs_lzma *strm =3D 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=3Dm68k. Best regards Uwe --sfor6dhu35gfvxc4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmpwW40ACgkQj4D7WH0S /k5LwAf/cdL6nHd/eq299wreF7wmJ/uzYymvnXI6g+WJKc5gZTwGHYeRdcLbnNux 3HBeU54Tekgm2/c8Dzf1HKMr8yW83g9d+dnWpEhjjrBtU1neZDCs8SkUV5cZmtAZ eBU0DQ6xEvWD5+uUuCkoluWU/0jQXAzzdhpGcGBTCFRIORwXEwDpRK/190nXO64u TNhzAxYRmmWop9WnxcL6ZsVv/d/bcRHM+th39zYaV3bfh6XDNsjhYriUqkcJVezF +XTq18Wb4HY77xH61A0s/5cd75E3/zLtHfoqb6oGX7PpiEsliZxqUKdIPPpytxBf xOsHM7j3e1USwS8UybcC6AKsa7K+bw== =9m7x -----END PGP SIGNATURE----- --sfor6dhu35gfvxc4--