netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang Weidong <wangweidong1@huawei.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: <davem@davemloft.net>, <vyasevich@gmail.com>,
	<dborkman@redhat.com>, <sergei.shtylyov@cogentembedded.com>,
	<netdev@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] sctp: optimize the sctp_sysctl_net_register
Date: Fri, 14 Feb 2014 10:18:05 +0800	[thread overview]
Message-ID: <52FD7CDD.1010206@huawei.com> (raw)
In-Reply-To: <20140213124434.GA27319@hmsreliant.think-freely.org>

On 2014/2/13 20:44, Neil Horman wrote:
> On Thu, Feb 13, 2014 at 09:19:25AM +0800, Wang Weidong wrote:
>> On 2014/2/12 19:53, Neil Horman wrote:
>>> On Wed, Feb 12, 2014 at 09:44:44AM +0800, 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 | 17 ++++++++++-------
>>>>  1 file changed, 10 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
>>>> index d354de5..35c8923 100644
>>>> --- a/net/sctp/sysctl.c
>>>> +++ b/net/sctp/sysctl.c
>>>> @@ -402,15 +402,18 @@ 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;
>>>> +
>>>> +	if (!net_eq(net, &init_net)) {
>>>> +		int i;
>>>>  
>>>> -	table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);
>>>> -	if (!table)
>>>> -		return -ENOMEM;
>>>> +		table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);
>>>> +		if (!table)
>>>> +			return -ENOMEM;
>>>>  
>>>> -	for (i = 0; table[i].data; i++)
>>>> -		table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;
>>>> +		for (i = 0; table[i].data; i++)
>>>> +			table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;
>>>> +	}
>>>>  
>>> In the first version of this patch you complained about a lockdep issue.  Did
>>> you figure out what that was, and if it related to these changes?
>>>
>>> Neil
>>>
>>>
>> Hi Neil,
>>
>> The lockdep issue doesn't relate to these changes. I should send it
>> by the another email. Sorry for confusing you.
>>
>> Regards
>> Wang
>>
> Then you probably don't need to mention it in the same note that you're
> proposing changes.
> 
Ok. Got it!

Thanks
Wang

> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> 
> 
> .
> 

  reply	other threads:[~2014-02-14  2:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12  1:44 [PATCH v3 0/2] sctp: fix a problem with net_namespace Wang Weidong
2014-02-12  1:44 ` [PATCH v3 1/2] sctp: fix a missed .data initialization Wang Weidong
2014-02-12  1:44 ` [PATCH v3 2/2] sctp: optimize the sctp_sysctl_net_register Wang Weidong
2014-02-12 11:53   ` Neil Horman
2014-02-13  1:19     ` Wang Weidong
2014-02-13 12:44       ` Neil Horman
2014-02-14  2:18         ` Wang Weidong [this message]
2014-02-13 22:13 ` [PATCH v3 0/2] sctp: fix a problem with net_namespace David Miller

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=52FD7CDD.1010206@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).