Re: [PATCH] debugobjects: Allow to configure the amount of pre-allocated objects

From: Benjamin Block

Date: Wed Mar 11 2026 - 06:36:38 EST


On Wed, Feb 25, 2026 at 05:05:08PM +0100, Benjamin Block wrote:
> To debug object operations a certain amount of metadata has to be kept
> per object that is tracked. During boot a static amount of pre-
> allocated objects is set aside to be used for this task until such a
> time a dynamic allocator can be used. Once a dynamic allocator can be
> used an initial amount of objects is pre-allocated to be used when
> needed.
>
> So far the amount of such initially statically, and later dynamically
> pre-allocated objects is set fixed at `64 * 16 = 1024`. But depending on
> the system this might not be enough during boot, when only the static
> amount of pre-allocated objects is used; and once this happens ODEBUG
> disables itself permanently.
>
> On s390 it has been observed, that even with 16384 such pre-allocated
> objects ODEBUG would still be disabled during boot.
>
> Similarly to other debug features like KMEMLEAK add a Kconfig option
> CONFIG_DEBUG_OBJECTS_POOL_SIZE_SHIFT that allows to increase the amount
> of pre-allocated objects (in both the static and later dynamic cases).
> Use it as exponential, rather than linear value to allow for head-room
> to grow into once set in a configuration.
>
> The calculation is done as such:
> N_OBJECTS = 2^DEBUG_OBJECTS_POOL_SIZE_SHIFT * N_BATCH
>
> By default it is set to 6, so the actual amount is unchanged, unless
> the new options is changed:
> N_OBJECTS = 2^6 * 16
> N_OBJECTS = 1024
>
> For the previously mentioned observations on s390 it was necessary to
> increase the option to 11 in order to have enough space during boot.
>
> Signed-off-by: Benjamin Block <bblock@xxxxxxxxxxxxx>
> ---
> lib/Kconfig.debug | 32 ++++++++++++++++++++++++++++++++
> lib/debugobjects.c | 15 +++++++++++++--
> 2 files changed, 45 insertions(+), 2 deletions(-)

Gentle ping, any comments at all for tis?

--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vors. Aufs.-R.: Wolfgang Wendt / Geschäftsführung: David Faller
Sitz der Ges.: Ehningen / Registergericht: AmtsG Stuttgart, HRB 243294