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]
Date:   Tue, 19 Jun 2018 10:18:38 +0800
From:   Li RongQing <roy.qing.li@...il.com>
To:     Li RongQing <lirongqing@...du.com>
Cc:     netdev@...r.kernel.org, steffen.klassert@...unet.com
Subject: Re: [PATCH][ipsec] xfrm: replace NR_CPU with num_possible_cpus()

sorry,  please drop this patch.
I should replace NR_CPUS with nr_cpu_ids, i will resend it

-R

On 6/15/18, Li RongQing <lirongqing@...du.com> wrote:
> The default NR_CPUS can be very large, but actual possible nr_cpu_ids
> usually is very small. For some x86 distribution, the NR_CPUS is 8192
> and nr_cpu_ids is 4.
>
> when xfrm_init is running, num_possible_cpus() should work
>
> Signed-off-by: Li RongQing <lirongqing@...du.com>
> Signed-off-by: Wang Li <wangli39@...du.com>
> ---
>  net/xfrm/xfrm_policy.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index 40b54cc64243..cbb862463cbd 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -2988,12 +2988,13 @@ static struct pernet_operations __net_initdata
> xfrm_net_ops = {
>  void __init xfrm_init(void)
>  {
>  	int i;
> +	unsigned int nr_cpus = num_possible_cpus();
>
> -	xfrm_pcpu_work = kmalloc_array(NR_CPUS, sizeof(*xfrm_pcpu_work),
> +	xfrm_pcpu_work = kmalloc_array(nr_cpus, sizeof(*xfrm_pcpu_work),
>  				       GFP_KERNEL);
>  	BUG_ON(!xfrm_pcpu_work);
>
> -	for (i = 0; i < NR_CPUS; i++)
> +	for (i = 0; i < nr_cpus; i++)
>  		INIT_WORK(&xfrm_pcpu_work[i], xfrm_pcpu_work_fn);
>
>  	register_pernet_subsys(&xfrm_net_ops);
> --
> 2.16.2
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ