Some usages of RCU in the kernel code
Some usages of RCU in the kernel code
Posted Jan 7, 2008 10:14 UTC (Mon) by fbh (guest, #49754)In reply to: Some usages of RCU in the kernel code by PaulMcKenney
Parent article: What is RCU, Fundamentally?
Regarding the second point, I'm sorry, my fingers typed rcu_dereference() whereas my brain was
thinking to rcu_assign_pointer(). rcu_dereference() could be used in update-side code, as you
pointed out, but obviously not in __list_add_rcu().
Therefore __list_add_rcu() could be:
new->next = next;
new->prev = prev;
rcu_assign_pointer(prev->next, new);
next->prev = new;
The main advantage of this is readability IMHO.
You said that __list_add_rcu() must be protected by appropriate locking, and a memory barrier
is implied by lock acquisition which should be enough. But __list_add_rcu() has a memory
barrier in its implementation.
Thanks.
