Hi Patrick,
On Tue, Nov 15, 2016 at 03:22:59PM +0000, Patrick Bellasi wrote:
[...]
I'm wondering if your rb_tree usage can be extended to be lockless. This should be achievable by properly using reference couting for each node, thus marking a node as "in use" right after your rb_bext call, or better using RCU to protect the reader side.
This last option would be ultimately a better and more generic solution but it can became quite complex. You should still be able to find some exaple of RCU-protected rb-trees... in the past this technique has been already used for example by Nick Piggin in it's fully lockless dentry search [1] back in the 2011.
Thanks a lot for sharing related info. For rb-tree usage, basically I think it doesn't introduce any extra locking but completely rely on rq lock. If rb-tree introduce RCU for lockless looks like this will let things more complex, because we finally will get rq locking and rcu mixed.
Please let me know if I miss anything?
[...]
Thanks, Leo Yan