[RCU]rcu.txt

FILE: kernel-*/Documentation/RCU/rcu.txt
kernel-3.2.26

コード見たり、関連単語の理解が浅いので、意味を消化できずに書いています。
反芻して理解するヒトなので、ざっと流しておきます。

RCU Concepts

The basic idea behind RCU (read-copy update) is to split destructiveoperations into two parts, one that prevents anyone from seeing the dataitem being destroyed, and one that actually carries out the destruction.
RCU(read-copy update)の背後にある基本的な考え方は、破壊的な操作を2つに分けることである。
1つは破壊されるデータ要素を参照している側から、誰からも防ぐもの。
もうひとつは実際に破壊を行うもの。

A "grace period" must elapse between the two parts, and this grace periodmust be long enough that any readers accessing the item being deleted havesince dropped their references.
"grace period"(猶予期間)は、2つの部分で経過するべきであり、
この猶予期間は、破壊される要素にアクセスするどんな読み手も、参照先をなくしきるまでは、十分に長くなければならない。

For example, an RCU-protected deletionfrom a linked list would first remove the item from the list, wait fora grace period to elapse, then free the element.
たとえば、RCU-protectedなlinked-listから削除することは、最初にリストから要素を削除し、
猶予期間を待って、その後に、その要素を解放する。
See the listRCU.txt file for more information on using RCU with linked lists.
linked listでRCUを使うより多くの情報は、"listRCU.txt"ファイルを参照ください。

Frequently Asked Questions
よくある質問:
  • Why would anyone want to use RCU?\なぜRCUを使いたがるの?\The advantage of RCU's two-part approach is that RCU readers need not acquire any locks, perform any atomic instructions, write to shared memory, or (on CPUs other than Alpha) execute any memory barriers.\RCUの2つの部分に分けるアプローチの利点は、以下のとおりです。
    • RCUの読み手は、任意のロックを取得する必要が無い
    • RCUの読み手は、どんなアトミック操作も実行できる
    • RCUの読み手は、共有メモリへの書き込みができる
    • (Alphaを除いて)どんなメモリバリアの実行ができる
The fact that these operations are quite expensive on modern CPUs is what gives RCU its performance advantages in read-mostly situations.\これらの操作は、昨今のCPUでは非常にコストが高いという要因で、RCUは読み出しが多い状況下で、その性能を発揮します。\The fact that RCU readers need not acquire locks can also greatly simplify deadlock-avoidance code. \RCUの読み手はロックを取得する必要がないという要因で、非常にシンプルにデッドロックを除外するコードです。
  • How can the updater tell when a grace period has completed if the RCU readers give no indication when they are done? \RCUの読み手が、読み終わった時になにも通知しないなら、猶予期間が完了した時、更新者(updater)は、どのように伝えることができますか。\Just as with spinlocks, RCU readers are not permitted to block, switch to user-mode execution, or enter the idle loop.\spinlockたちのように、RCUの読み手はブロック・ユーザモードへのスイッチ、アイドルループへの遷移を許可されません。\Therefore, as soon as a CPU is seen passing through any of these three states, we know that that CPU has exited any previous RCU read-side critical sections. \したがって、CPUがこれら3つの状態のいずれかへ遷移するとともに、我々は、そのCPUが、前の読み出し側のクリティカルセクションを完了したことを知ることができる。\So, if we remove an item from a linked list, and then wait until all CPUs have switched context, executed in user mode, or executed in the idle loop, we can safely free up that item. \もし我々がlinked listから要素を削除するならば、すべてのCPUが、コンテキストを切り替え終わるか、ユーザモードを実行するか、アイドルループを実行するのを待ち、その要素を安全に解放することができます。\Preemptible variants of RCU (CONFIG_TREE_PREEMPT_RCU) get the same effect, but require that the readers manipulate CPU-local counters. \RCUのpreemptible 亜種(CONFIG_TREE_PREEMPT_RCU)は、同じ効果を得ますが、読み手にCPUローカルカウンタの操作を要求します。\These counters allow limited types of blocking within RCU read-side critical sections. \これらのカウンタは、RCUの読み手のクリティカルセクション中をブロッキングするための限定的なタイプです。\SRCU also uses CPU-local counters, and permits general blocking within RCU read-side critical sections. \SRCUもまた、CPUローカルカウンタを用い、RCUの読み出し側クリティカルセクション中の一般的なブロッキングを許容します。\These two variants of RCU detect grace periods by sampling these counters. \これら2つのRCUの変種は、これらのカウンタを参照することで、猶予期間を検出します。
  • If I am running on a uniprocessor kernel, which can only do one thing at a time, why should I wait for a grace period?\単一プロセッサkernel上で走行しているなら、同時に1つのことしかできない。何故猶予期間待たないといけないのか。\See the UP.txt file in this directory.\"UP.txt"を参照してください。
  • How can I see where RCU is currently used in the Linux kernel?\現在、Linux kernel内のどこで使われているか見る方法はありますか?\Search for "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", and the other RCUprimitives.Or grab one of the cscope databases from:\http://www.rdrop.com/users/paulmck/RCU/linuxusage/rculocktab.html\以下をさがしてみてください。ほかにRCU primitiveも。
    • rcu_read_lock
    • rcu_read_unlockcall_rcu
    • rcu_read_lock_bh
    • rcu_read_unlock_bh
    • call_rcu_bh
    • srcu_read_lock
    • srcu_read_unlock
    • synchronize_rcu
    • synchronize_net
    • synchronize_srcu
  • What guidelines should I follow when writing code that uses RCU?\RCUを使うようなコードを書くとき、どのガイドラインに従えばいいのですか?\See the checklist.txt file in this directory.\このディレクトリにある、checklist.txtファイルを見てください。
  • Why the name "RCU"?\なぜRCUって名前なの?\"RCU" stands for "read-copy update". The file listRCU.txt has more information on where this name came from, search for "read-copy update" to find it.\RCUは、"read-copy update"に基づきます。ファイル"listRCU.txt"に、この名前の由来より詳しい情報があります。"read-copy update"で探せば、それは見つかります。
  • I hear that RCU is patented? What is with that?\RCUは特許済みと聞いた。これについては?\Yes, it is. There are several known patents related to RCU, search for the string "Patent" in RTFP.txt to find them.\はいそうです。RCUに関するいくつかの既知の特許があります。"RTFP.txt"で"Patent"文字列を探すと見つかります。\Of these, one was allowed to lapse by the assignee, and the others have been contributed to the Linux kernel under GPL.\これらのうち、一方は譲受人によって失効させたものと、GPLの下でLinuxカーネルに貢献してきた。\There are now also LGPL implementations of user-level RCU available (http://lttng.org/?q=node/18).\今は、ユーザレベルのLGPL実装もあります(http://lttng.org/?q=node/18)。
  • I hear that RCU needs work in order to support realtime kernels?\RCUは、RT-kernelをサポートするために、必要だと聞いたのだけど?\This work is largely completed.Realtime-friendly RCU can be enabled via the CONFIG_TREE_PREEMPT_RCU kernel configuration parameter.\このworkは概ね完璧です。RT-friendlyなRCUは、kernel config.の"CONFIG_TREE_PREEMPT_RCU"で有効にすることができます。\However, work is in progress for enabling priority boosting of preempted RCU read-side critical sections. This is needed if you have CPU-bound realtime threads.\しかし、workはプリエンプト読み出し側のクリティカルセクションのpriority-boostingを可能にするために作業中です。これは、CPU-boundなRT-threadを持っていれば、必要です。
  • Where can I find more information on RCU?\もっと多くのRCUの情報はどこで見つけられますか?\See the RTFP.txt file in this directory. Or point your browser at http://www.rdrop.com/users/paulmck/RCU/.\ このディレクトリの"RTFP.txt"ファイルを見てください。または、http://www.rdrop.com/users/paulmck/RCU/ を見てください。
  • What are all these files in this directory?\このディレクトリ内のすべてのファイルはなんですの?\See 00-INDEX for the list.\リストは"00-INDEX"を見てね。