[ovs-dev] [PATCH v3 1/3] ofproto: Add reference count for Openflow groups.

Ryan Wilson 76511 wryan at vmware.com
Wed May 21 18:55:20 UTC 2014



>>>How about we remove the rwlock and only use ref count?
>>
>> We need the ref count to determine when we can free the group / bucket.
>> The rwlock is to serialize access to the ofgroup's properties. For
>> example, 2 threads could be accessing ofgroup's properties, but a ref
>> count doesn't prevent them from both editing its properties
>> simultaneously. Unfortunately, I think we still need both here.
>>
>
>Which field(s) are you worried about racing in particular? The stats
>fields are already
>protected with a mutex. Other fields should be read only, except the
>netlink message
>handling path, which should create a new copy of the ofgroup object.

You're right, the only field that's ever written after insertion is
ofgroup->hmap_node, which is only during deletion. The only time hmap_node
is read is during a group lookup where ofproto->groups_rwlock is locked.
So I think you're correct here, we can actually remove ofgroup->rwlock.

I'll reflect this change in my next patch. Thanks!




More information about the dev mailing list