Monday, June 3, 2013

RCU kernel documentation - RCU Concepts

kernel/Documentation/rcu.txt
RCU (Read-copy update) The basic idea is to put a destroy operation is divided into two steps: first, when the writer being destroyed, any reader will not be aware of the existence of the destruction of the action; second step is to perform a real destroyed. In between there is a "grace period"/elegant period/quiet/Time, this grace period must be long enough to ensure that the right to delete items reader read operations are completed read operation, and subtracting the read reference count . For example, RCU-protected list deletion First, the removal of entries from the list, waiting for enough "grace period", and then release the entries. Reference listRCU.txt document, which described in detail the use of RCU protected list.
Frequently Asked Questions (FAQ)
Everybody loves RCU reasons:
RCU's advanced nature is reflected in its request for a two-step method does not require any RCU reader locks, perform any atomic operation, write shared memory, or perform any memory barrier / memory barriors.We know that in modern CPUs, these operations are very time-consuming, so using RCU read-intensive operation makes a significant performance improvement. In addition, because the RCU readers need not apply locks, also simplifies the code to avoid deadlock.

In RCU reader can proactively notify operation is completed, the update route how to determine the grace period has ended?
Like spinlocks, RCU reader does not allow the process of blocking, switch to user-mode execution, or enter idle loop. Thus, once the CPU into one of these three states, then we can determine the RCU-protected critical area code has ended. So, when we remove an element from the list, wait for all of the CPU is switched off context, perform user mode or enter the idle loop, at this time we can secure the release of this element.
RCU has two variants: the inalienable RCU and SRCU, these two variants require readers maintain CPU-local count.
If you are running on a single processor, at the same time can do only one thing, why wait for the grace period?
See UP.txt (Uniprocessor)

How to find the kernel to use the RCU place?
Search 
rcu_read_lock, rcu_read_unlock, call_rcu, rcu_read_lock_bh, rcu_read_unlock_bh, call_rcu_bh,
srcu_read_lock, srcu_read_unlock, synchronize_rcu, synchronize_net, synchronize_srcu

Using the RCU Guide
checklist.txt

Why is it called RCU
RCU is read-copy Update abbreviation file listRCU.txt more detailed description of the origin of the name

No comments:

Post a Comment