Linux kernel tiny RCU, tree RCU

Source: Internet
Author: User

There are two RCU implementations in kernel, one is tiny RCU and the other is tree RCU. Both of these RCU were formerly classic RCU.
If you want to read the classic RCU implementation code, you must find kernel 2.6.26, because in kernel 2.6.27,classic RCU began to transform to use the tree node Scalable classic RCU, is now the tree RCU the shape of the skin.
So what is the relationship between tiny Rcu and classic RCU, tiny, as its name, is the compact classic RCU, specifically designed for single-CPU (UNIPROCEESOR) embedded systems (with very limited memory). In other words, the equivalent of the abridged version of classic RCU.

Classic RCU uses the global state RCU_CTRBLK, which provides two flaver of global state rcu_sched_ctrblk and RCU_BH_CTRBLK.
Tiny RCU follows these two global States and cuts the contents of the SMP section.
The tree RCU is the RCU_CTRBLK evolutionary component layer (hierarchical) structure, which is the trees. Global state Rcu_state, Hierarchical (tree) node Rcu_node,cpu Independent State Rcu_data, and CPU idle frequency conversion state rcu_dynticks. The Cpumask, which was originally in Rcu_ctrblk, was divided into Rcu_node qsmask in a layered manner.

Now that the tree RCU contains many features, it is not easy for the novice to separate the large structure members from the functional logic of many feature functions, and to study the (pure or primitive) path that is consistent with the design document description.
The design document describes the RCU implementation of classic RCU, which is kernel 2.6.16, and the shape of the tree RCU begins with kernel 2.6.17. If you are confused about the RCU implementation in the current kernel, you can choose to compare the RCU of the two versions mentioned above kernel.
Or you can refer to the first copy of scalable classic RCU submitted by the log document on the LWN website. The document, in Git diff, is a better way to show how classic RCU evolved to the tree RCU.
But you won't be able to study classic RCU very well from tiny RCU, although tiny RCU is a simplification of classic RCU, but it has basically removed the SMP (such as Qsmask), while tree RCU and classic RCU is an SMP-based implementation.
So if you compare tiny RCU as the classic RCU to the tree RCU, you will not find the shadow of the relevant part of the SMP at all, and the difference is huge and the evolutionary connection point (dependency) is not found, thus confusing.

Classic RCU's rcu_ctrblk has the qsmask of our well-known RCU documentation describing it to maintain (or perceive) a GP. and the tree RCU the qsmask to be layered, tiny rcu is to discard this qsmask. If you do not know this, when you compare the tree Rcu and tiny RCU, there will be a fault in the middle, contact is not.
This is because tiny RCU limits the condition of single CPU (uniprocessor). There is no per CPU variable in the tiny RCU implementation. And at the same time that the CPU submits the QS, it will initiate RCU SOFTIRQ, in other words, GP does not have additional maintenance management, just simply equate GP with each QS submission.

Classic RCU and tree RCU also use nxtlist and nxttail to maintain batch processing for 4-segment RCU callbacks. and tiny RCU reduced it to rcucblist, as well as donetail and curtail in the form of 2-segment RCU batch, and simplified maintenance.
When the consumer calls synchronize_sched or CALL_RCU, the synchronous (or deferred) callback is chained to the cur segment. When the Scheduler scheduler submits a QS, the cur segment's callback is included in the Done section and the RCU SOFTIRQ is initiated. When the kernel kernel processes the RCU SOFTIRQ, the callback batch is processed from the done segment.
Thus it is not easy to find tiny RCU in maintenance GP and Qs.

Tiny RCU and tree rcu are the result of the classic RCU in different directions, tiny RCU for uniprocessor and resource-constrained embedding to simplify (剦 cut) The classic RCU, the other tree RCU is to make classic RCU to the former Super multi-CPU (in the RCU document, a few of the Hundren said hundreds of CPU also insignificant, at least tens of thousands, then 2008) occasions, the evolution is more efficient and stable.
Kernel 2.6.27 is a watershed, classic RCU to the tree RCU evolution. Tiny RCU and tree rcu are the same products of the 2008.
In Kconfig, the tree RCU is the default RCU. If you need preempt RCU, you must use the tree RCU. In other words, tiny RCU does not support preempt RCU.

"Scalable classic RCU Implementation" kernel 2.6.27 the first to submit a log document based on the tree node layered classic RCU code.

"Hierarchical RCU"

"Rcu:the bloatwatch Edition" Tiny RCU design document.

"Simplifying RCU" kernel 3.11 Remove Config_preempt_tiny, that is, remove PREEMPT TINY RCU.

Linux kernel tiny RCU, tree RCU

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.