[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <263b875c-7485-1331-fec5-ff492a295d62@huawei.com>
Date: Wed, 11 Sep 2024 09:21:24 +0800
From: "Leizhen (ThunderTown)" <thunder.leizhen@...wei.com>
To: Thomas Gleixner <tglx@...utronix.de>, Andrew Morton
<akpm@...ux-foundation.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 4/6] debugobjects: Don't start fill if there are
remaining nodes locally
On 2024/9/10 23:29, Leizhen (ThunderTown) wrote:
>
>
> On 2024/9/9 21:51, Leizhen (ThunderTown) wrote:
>> +static void fill_pool(void)
>> +{
>> + gfp_t gfp = __GFP_HIGH | __GFP_NOWARN;
>> + static atomic_t cpus_allocating;
>>
>> if (unlikely(!obj_cache))
>> return;
>>
>> + /*
>> + * Avoid allocation and lock contention when
>> + *
>> + * - the CPU local pool has at least 2 objects left
>> + * - another CPU is already in the allocation path
>> + * - the global pool has not reached the critical level yet
>> + */
>> + if (this_cpu_read(percpu_obj_pool.obj_free) > 1 && atomic_read(&cpus_allocating) &&
>
> I rethink that 'cpus_allocating' and 'percpu_obj_pool.obj_free > 1' should be
> contradictory. We can only choose one of them. If 'cpus_allocating' can work,
> there's no need for another. Since I had no way to prove that 'cpus_allocating'
Sorry, I mistyped in a hurry yesterday, and it's 'percpu_obj_pool.obj_free > 1'
that should be deleted.
> would work, I removed it in V3.
>
>> + READ_ONCE(obj_pool_free) > (debug_objects_pool_min_level / 2))
>> + return;
>> +
>> + atomic_inc(&cpus_allocating);
>> while (READ_ONCE(obj_pool_free) < debug_objects_pool_min_level) {
>> struct debug_obj *new[ODEBUG_BATCH_SIZE];
>> int cnt;
>
--
Regards,
Zhen Lei
Powered by blists - more mailing lists