Re: [PATCH v2 3/3] mm/slub: correct the default value of slub_min_objects in doc

From: Hyeonggon Yoo
Date: Tue Dec 05 2023 - 19:22:47 EST


On Tue, Dec 5, 2023 at 11:11 PM Song, Xiongwei
<Xiongwei.Song@xxxxxxxxxxxxx> wrote:
>
> Hi Hyeonggon,
>
> > -----Original Message-----
> > From: Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>
> > Sent: Tuesday, December 5, 2023 8:54 AM
> > To: sxwjean@xxxxxx
> > Cc: vbabka@xxxxxxx; cl@xxxxxxxxx; linux-mm@xxxxxxxxx; penberg@xxxxxxxxxx;
> > rientjes@xxxxxxxxxx; iamjoonsoo.kim@xxxxxxx; roman.gushchin@xxxxxxxxx;
> > corbet@xxxxxxx; keescook@xxxxxxxxxxxx; arnd@xxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx;
> > gregkh@xxxxxxxxxxxxxxxxxxx; linux-doc@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Song,
> > Xiongwei <Xiongwei.Song@xxxxxxxxxxxxx>
> > Subject: Re: [PATCH v2 3/3] mm/slub: correct the default value of slub_min_objects in doc
> >
> > On Sun, Dec 3, 2023 at 9:16 AM <sxwjean@xxxxxx> wrote:
> > >
> > > From: Xiongwei Song <xiongwei.song@xxxxxxxxxxxxx>
> > >
> > > There is no a value assigned to slub_min_objects by default, it always
> > > is 0 that is initialized by compiler if no assigned value by command line.
> > > min_objects is calculated based on processor numbers in calculate_order().
> > > For more details, see commit 9b2cd506e5f2 ("slub: Calculate min_objects
> > > based on number of processors.")
> > >
> > > Signed-off-by: Xiongwei Song <xiongwei.song@xxxxxxxxxxxxx>
> >
> > While slub_min_objects equals zero by default, 'min_objects' overrides it to
> > 4 * (fls(nr_cpus) + 1) when not set. so when slub_min_objects is not
> > set, it would be
> > equal to or higher than 4. I'm not sure this level of implementation
> > detail is worth documenting.
>
> commit 9b2cd506e5f2 ("slub: Calculate min_objects based on number of processors.")
> has already given "processors min_objects" pair, do we really need to document
> the specific detail?

No, I don't think it needs to be documented, but neither do I think
"slub_min_objects is
0 by default" is correctly documented...

> > Also, I think patch 2 should update Documentation/mm/slub.rst too.
> > (slub_$param -> slab_param)
> I think people can know slub_$params are still supported by
> Documentation/mm/slub.rst, so we don't need to say the info again in
> this file. Is it better to do so just before removing slub_$params
> completely?

If we're deprecating and planning to drop slub_$params in the future,
IMHO it'd be less confusing if we change it now, rather than
when removing slub_$params completely (probably 10 years later)?

Thanks,
Hyeonggon

> > > ---
> > > Documentation/mm/slub.rst | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/Documentation/mm/slub.rst b/Documentation/mm/slub.rst
> > > index be75971532f5..1f4399581449 100644
> > > --- a/Documentation/mm/slub.rst
> > > +++ b/Documentation/mm/slub.rst
> > > @@ -150,7 +150,7 @@ list_lock once in a while to deal with partial slabs. That overhead is
> > > governed by the order of the allocation for each slab. The allocations
> > > can be influenced by kernel parameters:
> > >
> > > -.. slub_min_objects=x (default 4)
> > > +.. slub_min_objects=x (default 0)
> > > .. slub_min_order=x (default 0)
> > > .. slub_max_order=x (default 3 (PAGE_ALLOC_COSTLY_ORDER))
> > >
> > > --
> > > 2.34.1
> > >