Conversation
@joel_linux @ljs
It's not about performance, it's about not locking up the system. rwlocks are short and fast because they can't be preempted so new readers can still block writers. rwsems can sleep so it's much more likely to have writer starvation.
0
0
2
@joel_linux @ljs there's no good heuristic, either you have write fair or write unfair. There's one good alternative, and you already know what that is. 😉
0
0
3

@ljs @joel_linux RCU is simply broken down into three parts:

  • grace periods
  • quiescent states
  • synchronization

A quiescent state is a time or action that guarantees all grace periods that were running at the time of the synchronization have finished (but you do not care about grace periods that started after synchronization).

If a link list protected by disabling preemption, then the grace period is when preemption is disabled, and the quiescent state is when all CPUs have scheduled. So you can remove an item from the link list (where all readers must have preemption disabled to read it), and then wait for all CPUs to schedule which guarantees nothing has access to the item, where you are now free to delete it without worrying that something is reading it.

That’s the simple case. There’s more complex cases, but it all comes down to the three parts above.

0
2
2