On 05/08/2012 07:59 AM, Marek Lindner wrote:
On Tuesday, May 08, 2012 03:35:07 Matthias Schiffer wrote:
overall hash consistency might be a issue though - I would propose adding a hash_update function that updates a hash entry without deleting and re-adding the hlist node.
Can you give an example of such an "update" ? Where would we need it ?
It would be useful to keep the output consistent even when the hash is updated while the output is generated - as a delete-add sequence adds the new element at the head of the hlist, a RCU-locked reader will not see the element when the traversal position is between the head and the old position of the element. An hash_update could use hlist_replace_rcu() to replace an element in a way that each reader either sees the old or the new version, but none loses it completely.
A hash_update_if version that gets an additional callback that is provided with the old and the new element and gets to decide which element to keep in the hash could be used to compare the sequence numbers in the vis code and update the hash atomically.
Matthias