On 05/05/2012 03:47 PM, Yunkai Zhang wrote: > Hi guys: > > I have tried two methods to fix this problem. > > =The first method= > 1) Allow multiple version vnode_info exists > 2) Before we call queue_work(), we make refcnt++ of the newest version > of vnode_info, > and pass a pointer which references this vnode_info to work.fn(), > so that all other > functions can access vnode_info by this pointer. > 3) make refcnt-- in work.done(). > > Because these operations: refcnt++, refcnt-- and updating/deleting are > all in main thread, > we can keep them lock-free. > > But we should change so many functions' prototype: add a pointer > parameter to reference one of vnode_info. > > =The second method= > Introduce userspace RCU library. I found it can make program simple > and clarity. But It will increase the dependence on third-party > libraries for sheep. > > I want to use the second method:) > > What is your opinions? I am +1 for introducing RCU. I think we can't avoid it completely later when we introduce more and more internal intertwined structuring objects. Thanks, Yuan |