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: <e38f71f7-dfdb-5575-a028-96e696d2d13e@huawei.com>
Date:   Tue, 19 Jun 2018 15:48:44 +0800
From:   Yunsheng Lin <linyunsheng@...wei.com>
To:     Li RongQing <lirongqing@...du.com>, <netdev@...r.kernel.org>,
        <steffen.klassert@...unet.com>
Subject: Re: [PATCH][v2] xfrm: replace NR_CPU with nr_cpu_ids



On 2018/6/19 15:11, Li RongQing 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, so replace NR_CPU to save some memory
> 
> Signed-off-by: Li RongQing <lirongqing@...du.com>
> Signed-off-by: Wang Li <wangli39@...du.com>
> ---
>  net/xfrm/xfrm_policy.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index 40b54cc64243..f8188685c1e9 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -2989,11 +2989,11 @@ void __init xfrm_init(void)
>  {
>  	int i;
>  
> -	xfrm_pcpu_work = kmalloc_array(NR_CPUS, sizeof(*xfrm_pcpu_work),
> +	xfrm_pcpu_work = kmalloc_array(nr_cpu_ids, sizeof(*xfrm_pcpu_work),
>  				       GFP_KERNEL);

It seems that xfrm_pcpu_work is not used anymore, maybe it can be deleted to
save more memory.


>  	BUG_ON(!xfrm_pcpu_work);
>  
> -	for (i = 0; i < NR_CPUS; i++)
> +	for (i = 0; i < nr_cpu_ids; i++)
>  		INIT_WORK(&xfrm_pcpu_work[i], xfrm_pcpu_work_fn);
>  
>  	register_pernet_subsys(&xfrm_net_ops);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ