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

Harry Yoo <[email protected]> Tue, 4 Aug 2026 06:34:34 +0000
Newsgroups gmane.linux.kernel.cgroups,gmane.linux.kernel.mm,gmane.linux.kernel
Message-ID <anGHvwehVz5H5GO0@dev>
On Mon, Jul 27, 2026 at 04:07:48PM +0200, Vlastimil Babka (SUSE) wrote:
> Per sashiko [1], a fixed up version below. Couldn't trigger the issue
> although seems to me it's real. Perhaps can happen only with SLUB_TINY
> otherwise the sheaf can't have obj_exts allocated from objcg charge path.
> 
> [1] https://sashiko.dev/#/patchset/20260727-b4-objext_split-v3-0-c29ef0f1f257%40kernel.org?part=10
> 
> ----8<----
> From 905c6500e597a8ecf123ad167698f0a0c1a764bd Mon Sep 17 00:00:00 2001
> From: "Vlastimil Babka (SUSE)" <[email protected]>
> Date: Wed, 8 Jul 2026 17:04:36 +0200
> Subject: [PATCH] mm/slab: reduce slabobj_ext memory with allocation profiling
>  disabled
> 
> When memory allocation profiling is compiled in but permanently disabled
> on boot with (implicit or explicit) "never" parameter, stop allocating
> (thus wasting) memory for the codetag_ref parts of slabobj_ext metadata.
> 
> Do this by using the new slab_obj_ext_has_codetag() helper in
> cache_obj_ext_size().
> 
> Additionally add slab_obj_ext_has_codetag() checks in
> mark_obj_codetag_empty() and handle_failed_objexts_alloc(). The
> functions might get called with memory allocation profiling disabled,
> when the obj_ext array is allocated for objcg pointers only. Setting
> codetag refs as empty is unnecessary in that case, and with them not
> allocated anymore would now result in memory corruption.
> 
> Reviewed-by: Suren Baghdasaryan <[email protected]>
> Signed-off-by: Vlastimil Babka (SUSE) <[email protected]>
> ---

Reviewed-by: Harry Yoo <[email protected]>

-- 
Cheers,
Harry / Hyeonggon