public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: paulmck@linux.vnet.ibm.com, Trond.Myklebust@netapp.com,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] rcu: add rcu_access_pointer and rcu_dereference_protect
Date: Wed, 07 Apr 2010 18:29:17 +0200	[thread overview]
Message-ID: <1270657757.8141.30.camel@edumazet-laptop> (raw)
In-Reply-To: <26698.1270657193@redhat.com>

Le mercredi 07 avril 2010 =C3=A0 17:19 +0100, David Howells a =C3=A9cri=
t :

> Why not:
>=20
> 	ASSERT(atomic_read(&sk->sk_wmem_alloc) =3D=3D 0);
> 	filter =3D rcu_dereference(sk->sk_filter);
>=20
> This is much clearer, and you're not combining an unrelated assertion=
 with the
> RCU dereference.

1) Because we want the check being done only when CONFIG_PROVE_RCU is
set.

2) Because rcu_dereference() default condition is : 'Am I owning
rcu_read_lock() or equivalent'.=20
In this context, I am _not_ owning rcu lock, so we will trigger a
warning.


So this is best done as is :)

I personally find this very clear and clean, this is why I acked Paul
patch :)

If we were 100% sure testing sk_wmem_alloc is not necessary, we would
have put :

filter =3D rcu_dereference_check(sk->sk_filter, 1);




  reply	other threads:[~2010-04-07 16:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07 13:57 [PATCH 1/2] rcu: add rcu_access_pointer and rcu_dereference_protect David Howells
     [not found] ` <20100407135732.12414.16416.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2010-04-07 13:57   ` [PATCH 2/2] NFS: Fix RCU warnings in nfs_inode_return_delegation_noreclaim() David Howells
2010-04-07 14:56   ` [PATCH 1/2] rcu: add rcu_access_pointer and rcu_dereference_protect Eric Dumazet
2010-04-07 15:40     ` David Howells
2010-04-07 16:00       ` Eric Dumazet
2010-04-07 16:19         ` David Howells
2010-04-07 16:29           ` Eric Dumazet [this message]
2010-04-07 16:35           ` Eric Dumazet
2010-04-07 15:59     ` Paul E. McKenney

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=1270657757.8141.30.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.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