Re: [PATCH RFC 10/12] mm/slab: reduce slabobj_ext memory with allocation profiling disabled

Suren Baghdasaryan <[email protected]>
Newsgroups org.kernel.vger.cgroups,org.kernel.vger.linux-kernel
Message-ID <CAJuCfpGXHuhLmTJFXKrBmCOMb_j8bA3wndekuewh=TULjXTXNw@mail.gmail.com>
On Wed, Jul 15, 2026 at 3:11 AM Vlastimil Babka (SUSE)
<[email protected]> wrote:
>
> When memory allocation profiling is compiled in but permanently disabled
> on boot with (implicit or explicit) "never" parameter, stop allocating
> (wasting) memory for the codetag_ref parts of slabobj_ext metadata.
>
> Signed-off-by: Vlastimil Babka (SUSE) <[email protected]>

Looks good but we should verify that slab allocation performance is
not regressed, especially if
CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT=Y and then profiling was
disabled via "never" in the command line. I think that would be the
worst case scenario for performance.

Reviewed-by: Suren Baghdasaryan <[email protected]>

> ---
>  mm/slab.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/slab.h b/mm/slab.h
> index dcca86799fc9..a50347c9dbe3 100644
> --- a/mm/slab.h
> +++ b/mm/slab.h
> @@ -587,7 +587,7 @@ static inline size_t static_obj_ext_size(void)
>         if (IS_ENABLED(CONFIG_MEMCG))
>                 sz += 1;
>
> -       if (IS_ENABLED(CONFIG_MEM_ALLOC_PROFILING))
> +       if (slab_obj_ext_has_codetag())
>                 sz += 1;
>
>         return sizeof(struct slabobj_ext) * sz;
>
> --
> 2.55.0
>
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.