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] [day] [month] [year] [list]
Message-ID: <20250818025851.21413-1-wangfushuai@baidu.com>
Date: Mon, 18 Aug 2025 10:58:51 +0800
From: Fushuai Wang <wangfushuai@...du.com>
To: <daniel@...earbox.net>
CC: <andrii@...nel.org>, <ast@...nel.org>, <bpf@...r.kernel.org>,
	<eddyz87@...il.com>, <haoluo@...gle.com>, <john.fastabend@...il.com>,
	<jolsa@...nel.org>, <kpsingh@...nel.org>, <linux-kernel@...r.kernel.org>,
	<martin.lau@...ux.dev>, <sdf@...ichev.me>, <song@...nel.org>,
	<wangfushuai@...du.com>, <yonghong.song@...ux.dev>
Subject: Re: [PATCH bpf] bpf: Use cpumask_next_wrap() in get_next_cpu()

>> Replace the manual sequence of cpumask_next() and cpumask_first()
>> with a single call to cpumask_next_wrap() in get_next_cpu().
>> 
>> Signed-off-by: Fushuai Wang <wangfushuai@...du.com>
>> ---
>>   kernel/bpf/bpf_lru_list.c | 5 +----
>>   1 file changed, 1 insertion(+), 4 deletions(-)
>> 
>> diff --git a/kernel/bpf/bpf_lru_list.c b/kernel/bpf/bpf_lru_list.c
>> index 2d6e1c98d8ad..34881f4da8ae 100644
>> --- a/kernel/bpf/bpf_lru_list.c
>> +++ b/kernel/bpf/bpf_lru_list.c
>> @@ -21,10 +21,7 @@
>>   
>>   static int get_next_cpu(int cpu)
>>   {
>> -	cpu = cpumask_next(cpu, cpu_possible_mask);
>> -	if (cpu >= nr_cpu_ids)
>> -		cpu = cpumask_first(cpu_possible_mask);
>> -	return cpu;
>> +	return cpumask_next_wrap(cpu, cpu_possible_mask);
>>   }
> 
> Lets then get rid of the get_next_cpu() function since its only used
> once, and just use the cpumask_next_wrap() at call site ?
> 
> [...]
>                  raw_spin_unlock_irqrestore(&steal_loc_l->lock, flags);
> 
>                  steal = cpumask_next_wrap(steal, cpu_possible_mask);
>          } while (!node && steal != first_steal);
> [...]
>
 
Thank you for your suggestion.

> Btw, in $subj please target [PATCH bpf-next] given its a cleanup,
> not a fix.

I will send a v2 shortly.

Regards,
Wang.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ