On 10/10/14, 9:13 AM, "Ben Pfaff" <[email protected]> wrote:
>On Wed, Oct 08, 2014 at 02:09:50PM -0700, Daniele Di Proietto wrote: >> An rcu-slist can be read and written without explicit locking: it uses >>RCU >> protected pointers and compare-exchange operations. >> >> Signed-off-by: Daniele Di Proietto <[email protected]> > >I think that there are a couple of key properties of this list that >should be mentioned somewhere. > >First, this is a multiple-writer list. It will of course work as a >single-writer list as well, but a single-writer list can be implemented >with cheaper operations on the write side (there is no need for >compare-and-exchange). You're right, I have mentioned that on the comments > >Second, when a list element has been removed, it must not be freed until >the next grace period (which is already stated), but it also must not be >modified or added back into the list or any other list before the next >grace period as well. You're right, I added an explanation. > >The condition in RCU_SLIST_FOR_EACH looks odd to me: > > INIT_CONTAINER(ITER, cursor__, MEMBER), cursor__; \ > >because it uses INIT_CONTAINER on a pointer that might be null, which is >wasteful and somewhat risky. I'd prefer to write it so that it only >uses INIT_CONTAINER if cursor__ if nonnull, even though that makes the >code uglier. So that would be something like: > > cursor__ && (INIT_CONTAINER(ITER, cursor__, MEMBER), true) I will change it like you suggested, thanks _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
