[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87plo6gyug.ffs@tglx>
Date: Fri, 11 Oct 2024 22:37:43 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: "Leizhen (ThunderTown)" <thunder.leizhen@...wei.com>, LKML
<linux-kernel@...r.kernel.org>
Cc: Waiman Long <longman@...hat.com>
Subject: Re: [patch 03/25] debugobjects: Dont destroy kmem cache in init()
On Thu, Oct 10 2024 at 21:31, Leizhen wrote:
> On 2024/10/10 19:46, Thomas Gleixner wrote:
>> On Thu, Oct 10 2024 at 10:14, Leizhen wrote:
>>> On 2024/10/8 0:49, Thomas Gleixner wrote:
>>>> - if (!obj_cache || debug_objects_replace_static_objects()) {
>>>> + if (!cache || !debug_objects_replace_static_objects(cache)) {
>>>> debug_objects_enabled = 0;
>>>> - kmem_cache_destroy(obj_cache);
>>>
>>> kmem_cache_destroy(cache) should be kept, or move it into debug_objects_replace_static_objects()
>>> and place it above 'return false'.
>>
>> At that point it can't be destroyed. See the backtrace.
>>
>> So we just give the objects back and leak the kmem_cache.
>
> Oh, sorry, I didn't figure it out before, but now I do.
> But shouldn't we add kmemleak_ignore(cache) ?
I don't know if it's worth the trouble. With the follow up changes the
only reason why this can happen is that the static object conversion
cannot allocate memory. Leaking the kmemcache in that case is the least
of the worries.
I just tripped over that back trace because I intentionally triggered
the error path.
Thanks,
tglx
Powered by blists - more mailing lists