On Fri, Aug 28, 2009 at 1:24 PM, Mulyadi Santosa <[email protected]>wrote:
> On Fri, Aug 28, 2009 at 2:47 PM, Pharaoh .<[email protected]> wrote: > > > How about RCU mechanism? > > > > I think using this I can design an efficient concurrently accessible rb > > tree. > > Any thoughts? > > IMO, in your case, since you need to implement tree structure and as > lockless as possible, RCU *could* be the answer. Or perhaps somekind > of mixed RCU and per CPU data i.e copy most read data to per CPU > variable and push it back to the related node of the tree when the > modification is done. Just a thought... > > Whether it really suits your need or not, it entirely depends on your > own specification and requirement > > -- > regards, > > Mulyadi Santosa > Freelance Linux trainer > blog: the-hydra.blogspot.com > I didnt quite understand the mixed mode as you describe it. First, If we have to copy the data to per cpu var and the use it then this copying might need to be protected. Second, why do we even have to copy it elsewhere? RCU technique takes care of the whole thing as per UTLK. Meaning different copies of tree will be created for read and write and eventually only a pointer update happens in in RCU which is atomic. I think RCU suits my requirement perfectly. I am going to have more readers than writers. One query here is can I use RCU for ISRs as well? UTLK says no kernel path should sleep while using RCU. So I can just use RCU and not worry about whether my tree is updated from process context or interrupt context? -Pharaoh.
