On Tuesday, May 08, 2012 22:18:34 Matthias Schiffer wrote:
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.
How the rcu replace / update mechanism works is pretty clear to me. My question geared towards our own code base. At which point would you use this rcu update ? Every time an element in the hash is modified ?
Regards, Marek