[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87msjagyq6.ffs@tglx>
Date: Fri, 11 Oct 2024 22:40:17 +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 08/25] debugobjects: Provide and use free_object_list()
On Thu, Oct 10 2024 at 10:54, Leizhen wrote:
> On 2024/10/8 0:50, Thomas Gleixner wrote:
>> Move the loop to free a list of objects into a helper function so it can be
>> reused later.
>>
>> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
>> ---
>> lib/debugobjects.c | 22 ++++++++++++++++------
>> 1 file changed, 16 insertions(+), 6 deletions(-)
>>
>> --- a/lib/debugobjects.c
>> +++ b/lib/debugobjects.c
>> @@ -125,6 +125,20 @@ static const char *obj_states[ODEBUG_STA
>> [ODEBUG_STATE_NOTAVAILABLE] = "not available",
>> };
>>
>> +static void free_object_list(struct hlist_head *head)
>> +{
>> + struct hlist_node *tmp;
>> + struct debug_obj *obj;
>> + int cnt = 0;
>> +
>> + hlist_for_each_entry_safe(obj, tmp, head, node) {
>> + hlist_del(&obj->node);
>> + kmem_cache_free(obj_cache, obj);
>> + cnt++;
>> + }
>> + debug_objects_freed += cnt;
>
> debug_objects_freed was previously protected by pool_lock. Use atomic?
It's statistics, so I'm not really worried about it whether it's a bit
off or not.
But aside of that the freeing is single threaded because objects are
only handed back to the kmem_cache from the worker thread.
Thanks,
tglx
Powered by blists - more mailing lists