Subject: Re: RCU info

From: Jarek Poplawski <[email-masked]>
Date: Fri, 12 Jan 2007 13:19:48 +0100

On Thu, Jan 11, 2007 at 09:42:13AM -0800, Stephen Hemminger wrote:
> Paul McKenney has given lots of talks on RCU see:
> 	http://www.rdrop.com/users/paulmck/RCU/
> 
> and look in Documentation/RCU
 
I've read a lot of this but it's sometimes confusing e.g.:

>>From Documentation/RCU/checklist.txt:

>9.      All RCU list-traversal primitives, which include
>        list_for_each_rcu(), list_for_each_entry_rcu(),
>        list_for_each_continue_rcu(), and list_for_each_safe_rcu(),
>        must be within an RCU read-side critical section.  RCU
>        read-side critical sections are delimited by rcu_read_lock()
>        and rcu_read_unlock(), or by similar primitives such as
>        rcu_read_lock_bh() and rcu_read_unlock_bh().

So "All" and "must be"!

>        Use of the _rcu() list-traversal primitives outside of an
>        RCU read-side critical section causes no harm other than
>        a slight performance degradation on Alpha CPUs.  It can
>        also be quite helpful in reducing code bloat when common
>        code is shared between readers and updaters.

... or not all and not must be?

I think, probably because of examples in those docs -  mostly with 
spin_locks (or without preemption), I've got wrong conviction that
writers (or more often readers and writers) in their reading part
aren't allowed to be preempted or block also. But after rethinking
yesterday explanation of David Miller I undestood the writers have
more possibilities and individual analyzis is required each time.

Many thanks once more to everyone,

Jarek P.