From: Yunsheng Lin <linyunsheng@huawei.com>
To: Li RongQing <lirongqing@baidu.com>, <netdev@vger.kernel.org>,
<steffen.klassert@secunet.com>
Subject: Re: [PATCH][v2] xfrm: replace NR_CPU with nr_cpu_ids
Date: Tue, 19 Jun 2018 15:48:44 +0800 [thread overview]
Message-ID: <e38f71f7-dfdb-5575-a028-96e696d2d13e@huawei.com> (raw)
In-Reply-To: <1529392300-8298-1-git-send-email-lirongqing@baidu.com>
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@baidu.com>
> Signed-off-by: Wang Li <wangli39@baidu.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);
>
next prev parent reply other threads:[~2018-06-19 7:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-19 7:11 [PATCH][v2] xfrm: replace NR_CPU with nr_cpu_ids Li RongQing
2018-06-19 7:48 ` Yunsheng Lin [this message]
2018-06-19 7:53 ` Florian Westphal
2018-06-19 12:17 ` Steffen Klassert
2018-06-20 9:55 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e38f71f7-dfdb-5575-a028-96e696d2d13e@huawei.com \
--to=linyunsheng@huawei.com \
--cc=lirongqing@baidu.com \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox