lkml.org 
[lkml]   [2012]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/6] cls_cgroup: remove redundant rcu_read_lock/unlock
On Wed, Feb 01, 2012 at 03:20:00PM +0800, Li Zefan wrote:
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
>
> >> diff --git a/net/core/sock.c b/net/core/sock.c
> >> index 213c856..c0bab23 100644
> >> --- a/net/core/sock.c
> >> +++ b/net/core/sock.c
> >> @@ -1160,9 +1160,7 @@ void sock_update_classid(struct sock *sk)
> >> {
> >> u32 classid;
> >>
> >> - rcu_read_lock(); /* doing current task, which cannot vanish. */
> >> classid = task_cls_classid(current);
> >> - rcu_read_unlock();
> >> if (classid && classid != sk->sk_classid)
> >> sk->sk_classid = classid;
> >
> > Yes, this seems fine.
> >
> > Then, I wonder why we do the "if (classid && classid != sk->sk_classid)"
> >
> > before the :
> >
> > sk->sk_classid = classid;
> >
> > This seems unnecessary checks.
> >
>
> I was wondering about this too. He who added this may provide us with an
> answer.

Well writing a cache-line unnecessarily is bad.

Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


\
 
 \ /
  Last update: 2012-02-01 08:25    [W:0.043 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site