RCU
Reading a few LWN articles on RCUs (1 2 3) really shed some light on their properties and use.
On read-intensive scenarios, it's more efficient to replace read/write locking with an RCU. This is possible because all Linux platforms have atomic pointer read/write operations.
Read critical section
On read-intensive scenarios, it's more efficient to replace read/write locking with an RCU. This is possible because all Linux platforms have atomic pointer read/write operations.
Read critical section
dereferences pointers through a mechanism with platform specific memory ordering guarantees: rcu_dereference()
- may not sleep
- may not keep or pass dereferenced pointers outside the critical section
- Protects agains concurrent writes using regular spinlock mutex
- Makes a copy of the original structure, making updates in the copy
- Swaps in the new version, while still keeping the old version (atomic)
- Invokes synchronize_rcu() to wait for all readers to exit their current rcu read critical sections.
- ( A non-pre-emptible kernel can simpy wait for all CPUs to switch contexts. )
- Free the old version
Comments
Post a Comment