Re: [PATCH] erofs: fix EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS on some UP platforms

Geert Uytterhoeven <[email protected]>
Newsgroups org.ozlabs.lists.linux-erofs,org.kernel.vger.linux-kernel
Message-ID <CAMuHMdWmcj5SQ-AbyhWL3jiPJKdmNq64m-BOAe3T7HPjJqaDBw@mail.gmail.com>
Hi Gao,

On Mon, 17 Aug 2026 at 10:10, Gao Xiang <[email protected]> wrote:
> On Mon, Aug 17, 2026 at 10:05:09AM +0200, Geert Uytterhoeven wrote:
> > On Mon, 17 Aug 2026 at 09:49, Gao Xiang <[email protected]> wrote:
> > > On Mon, Aug 17, 2026 at 09:32:51AM +0200, Geert Uytterhoeven wrote:
> > > > Thanks for your patch, which is now commit a64d500b0078e16e ("erofs: fix
> > > > EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS on some UP platforms") in v7.2.
> > > >
> > > > > --- a/fs/erofs/Kconfig
> > > > > +++ b/fs/erofs/Kconfig
> > > > > @@ -134,7 +134,8 @@ config EROFS_FS_ZIP_LZMA
> > > > >  config EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS
> > > > >         int "EROFS LZMA default maximum decompression streams"
> > > > >         depends on EROFS_FS_ZIP_LZMA
> > > > > -       range 1 NR_CPUS
> > > > > +       range 1 NR_CPUS if SMP
> > > > > +       range 1 1 if !SMP
> > > > >         default 16
> > > >
> > > > I have just discovered another oddity: when you have less than 16
> > > > CPUS (including SMP=n), this default value is invalid, and "make
> > > > savedefconfig" will always write a line like
> > > >
> > > >     CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=1
> > > >
> > > > to the defconfig file, even if that is the default suggested value.
> > > >
> > > > Needlessly polluting the defconfig files could be fixed using:
> > > >
> > > >     -       default 16
> > > >     +       default 16 if SMP && NR_CPUS >= 16
> > > >     +       default NR_CPUS if SMP
> > >
> > > I guess `default NR_CPUS if SMP && NR_CPUS < 16` would be better,
> > > I'm not sure since I'm not handy in Kconfig stuffs.
> >
> > Kconfig always picks the first matching default value, so you don't
> > have to exclude the "SMP && NR_CPUS >= 16" case here.
> >
> > > >     +       default 1 if !SMP
> >
> > If all architectures would always define NR_CPUS, one could replace
> > the last two lines by
> >
> >     default NR_CPUS
> >
> > > >
> > > > Thoughts?
> > >
> > > In principle, that would be better, but may I ask if there is some
> > > severe consequences out of one extra line of
> > > CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=1?
> > >
> > > Since it has been fixed for many times, I hope if it could be improved
> > > later if no severe impacts, sigh..
> >
> > It causes more churn (defconfig updates), and makes the defconfig
> > files larger than needed.
>
> Could you submit a formal patch directly (since you found it and
> suggested a version)?
>
> so I could submit it along with the pull request if you're fine with it.

Will do, I want to do a bit more testing first...
In addition, usability can be improved by hiding the prompt on UP
systems:

-       int "EROFS LZMA default maximum decompression streams"
+       int "EROFS LZMA default maximum decompression streams" if SMP

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.