Re: [PATCH] erofs: Fix EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic
From: Geert Uytterhoeven
Date: Thu Aug 20 2026 - 10:21:25 EST
Hi Gao,
On Thu, 20 Aug 2026 at 14:56, Gao Xiang <xiang@xxxxxxxxxx> wrote:
> On Thu, Aug 20, 2026 at 12:00:23PM +0200, Geert Uytterhoeven wrote:
> > When NR_CPUS is less than 16, or when SMP is disabled, the default value
> > of 16 is invalid.
> >
> > While actual configuration picks up a sensible and valid default
> > (NR_CPUS or 1), "make savedefconfig" will still write a line like
> >
> > CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=1
> >
> > to the defconfig file, even if that matches the sensible default.
> >
> > Avoid needlessly enlarging the defconfig files, and reduce churn for
> > updating them, by specifying valid defaults depending on SMP and
> > NR_CPUS.
> >
> > While at it, make the prompt depend on SMP, as there is no point in
> > asking the user about the maximum number of decompression streams if
> > there is only one valid answer.
> >
> > Fixes: c9b47e6b23114e93 ("erofs: cap LZMA stream pool size")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> > ---
> > fs/erofs/Kconfig | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
> > index 2dfc313588d283a0..37495e95a78d9bf6 100644
> > --- a/fs/erofs/Kconfig
> > +++ b/fs/erofs/Kconfig
> > @@ -132,11 +132,13 @@ config EROFS_FS_ZIP_LZMA
> > Say N if you want to disable LZMA compression support.
> >
> > config EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS
> > - int "EROFS LZMA default maximum decompression streams"
> > + int "EROFS LZMA default maximum decompression streams" if SMP
>
> As I said, if NR_CPUS is meaningful for both SMP or !SMP, there should
> not be SMP involved in this Kconfig.
>
> In other words, if SMP below is just a workaround since some arches
> leave NR_CPUS = 0 if !SMP. If NR_CPUS is valid unconditionally, I don't
> think SMP is at all useful here.
Ideally, this should be "if NR_CPUS > 1". But we can't do that until
all (i.e. most) architectures that do not define NR_CPUS if SMP=n
are fixed.
> Could you just drop if SMP and leave this configuration unconditionally
> shown for users? It's easy for all users to get how this Kconfig works.
I cannot. There are +20000 configuration symbols. No one wants to see
questions that are irrelevant.
I can change it to "if SMP && NR_CPUS > 1", though ;-)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
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