lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ca59d908-7779-8f84-57df-0298888a7340@huawei.com>
Date: Tue, 3 Sep 2024 20:14:35 +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 4/5] debugobjects: Use hlist_splice_init() to reduce lock
 conflicts



On 2024/9/3 18:09, Thomas Gleixner wrote:
> On Mon, Sep 02 2024 at 22:05, Zhen Lei wrote:
> 
>> The sub list can be prepared in advance outside the lock, so that the
>> operation time inside the lock can be reduced and the possibility of
>> lock conflict can be reduced.
>>
>> Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
>> ---
>>  lib/debugobjects.c | 18 ++++++++++--------
>>  1 file changed, 10 insertions(+), 8 deletions(-)
>>
>> diff --git a/lib/debugobjects.c b/lib/debugobjects.c
>> index fc8224f9f0eda8f..998724e9dee526b 100644
>> --- a/lib/debugobjects.c
>> +++ b/lib/debugobjects.c
>> @@ -167,23 +167,25 @@ static void fill_pool(void)
>>  		return;
>>  
>>  	while (READ_ONCE(obj_pool_free) < debug_objects_pool_min_level) {
>> -		struct debug_obj *new[ODEBUG_BATCH_SIZE];
>> +		HLIST_HEAD(batch_list);
>> +		struct debug_obj *new, *last;
> 
> Variable ordering please.

OK

> 
>>  		int cnt;
>>  
>>  		for (cnt = 0; cnt < ODEBUG_BATCH_SIZE; cnt++) {
>> -			new[cnt] = kmem_cache_zalloc(obj_cache, gfp);
>> -			if (!new[cnt])
>> +			new = kmem_cache_zalloc(obj_cache, gfp);
>> +			if (!new)
>>  				break;
>> +			hlist_add_head(&new->node, &batch_list);
>> +			if (cnt == 0)
>                         
>                         if (!cnt)
> 
> but it would be more self explaining if you have:
> 
> 		struct debug_obj *new, *last = NULL;
> 
> and then
>                 if (!last)

OK, I will change it. I thought so, but I changed it to reduce
the null initialization. Ha ha, wrong choice.

> 
>> +				last = new;
>>  		}
> 
> Thanks,
> 
>         tglx
> .
> 

-- 
Regards,
  Zhen Lei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ