netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] ipv6: remove useless spin_lock/spin_unlock
Date: Wed, 3 Dec 2014 10:05:19 +0800	[thread overview]
Message-ID: <547E6FDF.2040809@cn.fujitsu.com> (raw)
In-Reply-To: <1417571879.5303.83.camel@edumazet-glaptop2.roam.corp.google.com>

On 12/03/2014 09:57 AM, Eric Dumazet wrote:
> On Wed, 2014-12-03 at 09:32 +0800, Duan Jiong wrote:
>> xchg is atomic, so there is no necessary to use spin_lock/spin_unlock
>> to protect it.
>>
>> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>> ---
>>  net/ipv6/ipv6_sockglue.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
>> index e1a9583..92ca907 100644
>> --- a/net/ipv6/ipv6_sockglue.c
>> +++ b/net/ipv6/ipv6_sockglue.c
>> @@ -112,9 +112,7 @@ struct ipv6_txoptions *ipv6_update_options(struct sock *sk,
>>  		}
>>  		opt = xchg(&inet6_sk(sk)->opt, opt);
>>  	} else {
>> -		spin_lock(&sk->sk_dst_lock);
>>  		opt = xchg(&inet6_sk(sk)->opt, opt);
>> -		spin_unlock(&sk->sk_dst_lock);
>>  	}
>>  	sk_dst_reset(sk);
>>  
> 
> Why keeping 2 copies of opt = xchg(&inet6_sk(sk)->opt, opt); then ?
> 

Thanks for you remind, i didn't notice that.
The else statement could be removed, opt = xchg(&inet6_sk(sk)->opt, opt); should be
moved out, and i will send v2.

Thanks,
  Duan

> 
> 
> 

  reply	other threads:[~2014-12-03  2:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03  1:32 [PATCH net-next] ipv6: remove useless spin_lock/spin_unlock Duan Jiong
2014-12-03  1:57 ` Eric Dumazet
2014-12-03  2:05   ` Duan Jiong [this message]
2014-12-03  2:29 ` [PATCH net-next v2] " Duan Jiong
2014-12-03  5:18   ` Joe Perches
2014-12-09 18:18   ` 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=547E6FDF.2040809@cn.fujitsu.com \
    --to=duanj.fnst@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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).