Re: [PATCH 1/2] Revert "mm/kmemleak: move the initialisation of object to __link_object"

From: Catalin Marinas
Date: Wed Nov 15 2023 - 09:17:15 EST


On Wed, Nov 15, 2023 at 04:21:37PM +0800, Liu Shixin wrote:
> Move the initialisation of object back to__alloc_object() because
> set_track_prepare() attempt to acquire zone->lock(spinlocks) while
> __link_object is holding kmemleak_lock(raw_spinlocks). This is not
> right for RT mode.
>
> This reverts commit 245245c2fffd0050772a3f30ba50e2be92537a32.
>
> Signed-off-by: Liu Shixin <liushixin2@xxxxxxxxxx>

You can also add:

Fixes: 245245c2fffd ("mm/kmemleak: move the initialisation of object to __link_object")

Acked-by: Catalin Marinas <catalin.marinas@xxxxxxx>

I now realised that we update the object allocation stack trace via the
delete_object_part() when we shouldn't. I'd say __alloc_object() can
take a trace_handle as argument and if it's !0, set it directly whithout
calling set_track_prepare() (as a separate patch).

--
Catalin