0

As a Linux kernel programmer, I have been learned to use RCU instead of rwlock to obtain high performance. However RCU only provide the following API without parameter to service protection of all kinds of data types.

rcu_read_lock()
rcu_read_unlock()

As rwlock will hold an argument lock for each individual.

read_lock(lock)
write_lock(lock)

If RCU only hold a system global lock, it it reasonable? The reclamation blocks until all readers of others data types to finish. Will it harm the global system performance?

river
  • 646
  • 5
  • 20
  • `The reclamation blocks until all readers of others data types to finish.` - More precise, reclamation blocks until all readers, **started before or at** a reclamation callback is registered, are finished. Ability of RCU to not wait for *further* critical sections makes it different from "single global spinlock" paradigm. `Will it harm the global system performance?` - It depends. In most cases you may assume that RCU is better than a spinlock whenever it is applicable. – Tsyvarev Aug 27 '18 at 15:17
  • I have another question, can you answer it? @Tsyvarev https://stackoverflow.com/questions/51906424/why-does-synchronize-rcu-not-deadlock-when-beening-called-inside-a-read-lock – river Sep 04 '18 at 09:04

0 Answers0