netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang Weidong <wangweidong1@huawei.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	<nhorman@tuxdriver.com>, <davem@davemloft.net>,
	<vyasevich@gmail.com>
Cc: <dborkman@redhat.com>, <netdev@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] sctp: optimize the sctp_sysctl_net_register
Date: Wed, 12 Feb 2014 09:21:05 +0800	[thread overview]
Message-ID: <52FACC81.2090405@huawei.com> (raw)
In-Reply-To: <52FA5418.6090007@cogentembedded.com>

On 2014/2/12 0:47, Sergei Shtylyov wrote:
> Hello.
> 
> On 02/11/2014 04:49 AM, Wang Weidong wrote:
> 
>> Here, when the net is init_net, we needn't to kmemdup the ctl_table
>> again. So add a check for net. Also we can save some memory.
> 
>> Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
>> ---
>>   net/sctp/sysctl.c | 16 +++++++++-------
>>   1 file changed, 9 insertions(+), 7 deletions(-)
> 
>> diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
>> index 2ddb401..b65396b 100644
>> --- a/net/sctp/sysctl.c
>> +++ b/net/sctp/sysctl.c
>> @@ -403,15 +403,17 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
>>
>>   int sctp_sysctl_net_register(struct net *net)
>>   {
>> -    struct ctl_table *table;
>> -    int i;
>> +    struct ctl_table *table = sctp_net_table;
>>
>> -    table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);
>> -    if (!table)
>> -        return -ENOMEM;
>> +    if (!net_eq(net, &init_net)) {
>> +        int i;
> 
>    Empty line after declaration wouldn't hurt, just like above.
> 
Yeah. I will change it soon.

Thanks
Wang

>> +        table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);
>> +        if (!table)
>> +            return -ENOMEM;
> 
> WBR, Sergei
> 
> -- 
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

      reply	other threads:[~2014-02-12  1:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11  1:49 [PATCH v2 0/2] sctp: fix a problem with net_namespace Wang Weidong
2014-02-11  1:49 ` [PATCH v2 1/2] sctp: fix a missed .data initialization Wang Weidong
2014-02-11  1:49 ` [PATCH v2 2/2] sctp: optimize the sctp_sysctl_net_register Wang Weidong
2014-02-11 16:47   ` Sergei Shtylyov
2014-02-12  1:21     ` Wang Weidong [this message]

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=52FACC81.2090405@huawei.com \
    --to=wangweidong1@huawei.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=vyasevich@gmail.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;
as well as URLs for NNTP newsgroup(s).