All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: dhowells@redhat.com, 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 17:19:53 +0100	[thread overview]
Message-ID: <26698.1270657193@redhat.com> (raw)
In-Reply-To: <1270656035.8141.23.camel@edumazet-laptop>

Eric Dumazet <eric.dumazet@gmail.com> wrote:

> > You've missed the point.
> 
> You already claimed I dont understand RCU. I find this claim funny.
> 
> > For rcu_access_pointer(), _nothing_ protects the data, not only that, we
> > don't care: we're only checking the pointer.
> 
> How can you state this ?
> 
> Thats pretty simple, "always true" is a fine condition.
> 
> What's the problem with this ?

If the condition for rcu_access_pointer() is always "always true", then it's
redundant, right?  rcu_access_pointer() is for checking the pointer only, not
checking the payload that pointer might point to.  So, what condition are you
supposed to be checking?
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> > but if 'c' is supposed to be the locks that protect the data, is this a
> > valid check?
> 
> 'c' is not a lock. Its a condition.

Sorry, I meant the state of the relevant locking context.

To take your example:

> filter = rcu_dereference_check(sk->sk_filter,
> 			       atomic_read(&sk->sk_wmem_alloc) == 0);

what is the value of sk->sk_wmem_alloc to the lock context of sk->sk_filter?
Why would lockdep be interested in sk_wmem_alloc?

Surely, the assertion that the value of sk->sk_filter is related to
sk_wmem_alloc being 0 is independent of the need to dereference sk_filter for
RCU purposes.  So why are these being combined?

Why not:

	ASSERT(atomic_read(&sk->sk_wmem_alloc) == 0);
	filter = rcu_dereference(sk->sk_filter);

This is much clearer, and you're not combining an unrelated assertion with the
RCU dereference.

David

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

Thread overview: 15+ 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 13:57     ` David Howells
2010-04-07 14:56   ` [PATCH 1/2] rcu: add rcu_access_pointer and rcu_dereference_protect Eric Dumazet
2010-04-07 14:56     ` Eric Dumazet
2010-04-07 15:40     ` David Howells
2010-04-07 16:00       ` Eric Dumazet
2010-04-07 16:00         ` Eric Dumazet
2010-04-07 16:19         ` David Howells [this message]
2010-04-07 16:29           ` Eric Dumazet
2010-04-07 16:29             ` Eric Dumazet
2010-04-07 16:35           ` Eric Dumazet
2010-04-07 16:35             ` Eric Dumazet
2010-04-07 15:59     ` Paul E. McKenney
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=26698.1270657193@redhat.com \
    --to=dhowells@redhat.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=eric.dumazet@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.