[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1270657757.8141.30.camel@edumazet-laptop>
Date: Wed, 07 Apr 2010 18:29:17 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Howells <dhowells@...hat.com>
Cc: paulmck@...ux.vnet.ibm.com, Trond.Myklebust@...app.com,
linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] rcu: add rcu_access_pointer and
rcu_dereference_protect
Le mercredi 07 avril 2010 à 17:19 +0100, David Howells a écrit :
> 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.
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'.
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 = rcu_dereference_check(sk->sk_filter, 1);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists