>>>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!

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to