€•sIŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ/translations/zh_CN/RCU/rcu”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/zh_TW/RCU/rcu”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/it_IT/RCU/rcu”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/ja_JP/RCU/rcu”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/ko_KR/RCU/rcu”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/sp_SP/RCU/rcu”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒtarget”“”)”}”(hŒ .. _rcu_doc:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œrcu-doc”uh1h¡h KhhhžhhŸŒ5/var/lib/git/docbuild/linux/Documentation/RCU/rcu.rst”ubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ RCU Concepts”h]”hŒ RCU Concepts”…””}”(hh·hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hµhh²hžhhŸh¯h KubhŒ paragraph”“”)”}”(hXqThe basic idea behind RCU (read-copy update) is to split destructive operations into two parts, one that prevents anyone from seeing the data item being destroyed, and one that actually carries out the destruction. A "grace period" must elapse between the two parts, and this grace period must be long enough that any readers accessing the item being deleted have since dropped their references. For example, an RCU-protected deletion from a linked list would first remove the item from the list, wait for a grace period to elapse, then free the element. See listRCU.rst for more information on using RCU with linked lists.”h]”hXuThe basic idea behind RCU (read-copy update) is to split destructive operations into two parts, one that prevents anyone from seeing the data item being destroyed, and one that actually carries out the destruction. A “grace period†must elapse between the two parts, and this grace period must be long enough that any readers accessing the item being deleted have since dropped their references. For example, an RCU-protected deletion from a linked list would first remove the item from the list, wait for a grace period to elapse, then free the element. See listRCU.rst for more information on using RCU with linked lists.”…””}”(hhÇhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h Khh²hžhubh±)”}”(hhh]”(h¶)”}”(hŒFrequently Asked Questions”h]”hŒFrequently Asked Questions”…””}”(hhØhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hµhhÕhžhhŸh¯h KubhŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hXàWhy would anyone want to use 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. The fact that these operations are quite expensive on modern CPUs is what gives RCU its performance advantages in read-mostly situations. The fact that RCU readers need not acquire locks can also greatly simplify deadlock-avoidance code. ”h]”(hÆ)”}”(hŒ!Why would anyone want to use RCU?”h]”hŒ!Why would anyone want to use RCU?”…””}”(hhñhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h KhhíubhÆ)”}”(hX¼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. The fact that these operations are quite expensive on modern CPUs is what gives RCU its performance advantages in read-mostly situations. The fact that RCU readers need not acquire locks can also greatly simplify deadlock-avoidance code.”h]”hX¾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. The fact that these operations are quite expensive on modern CPUs is what gives RCU its performance advantages in read-mostly situations. The fact that RCU readers need not acquire locks can also greatly simplify deadlock-avoidance code.”…””}”(hhÿhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h Khhíubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëhhèhžhhŸh¯h Nubhì)”}”(hXÏHow can the updater tell when a grace period has completed if the RCU readers give no indication when they are done? Just as with spinlocks, RCU readers are not permitted to block, switch to user-mode execution, or enter the idle loop. 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. 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. Preemptible variants of RCU (CONFIG_PREEMPT_RCU) get the same effect, but require that the readers manipulate CPU-local counters. These counters allow limited types of blocking within RCU read-side critical sections. SRCU also uses CPU-local counters, and permits general blocking within RCU read-side critical sections. These variants of RCU detect grace periods by sampling these counters. ”h]”(hÆ)”}”(hŒtHow can the updater tell when a grace period has completed if the RCU readers give no indication when they are done?”h]”hŒtHow can the updater tell when a grace period has completed if the RCU readers give no indication when they are done?”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h KhjubhÆ)”}”(hXÌJust as with spinlocks, RCU readers are not permitted to block, switch to user-mode execution, or enter the idle loop. 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. 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.”h]”hXÌJust as with spinlocks, RCU readers are not permitted to block, switch to user-mode execution, or enter the idle loop. 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. 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.”…””}”(hj%hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h K hjubhÆ)”}”(hXŠPreemptible variants of RCU (CONFIG_PREEMPT_RCU) get the same effect, but require that the readers manipulate CPU-local counters. These counters allow limited types of blocking within RCU read-side critical sections. SRCU also uses CPU-local counters, and permits general blocking within RCU read-side critical sections. These variants of RCU detect grace periods by sampling these counters.”h]”hXŠPreemptible variants of RCU (CONFIG_PREEMPT_RCU) get the same effect, but require that the readers manipulate CPU-local counters. These counters allow limited types of blocking within RCU read-side critical sections. SRCU also uses CPU-local counters, and permits general blocking within RCU read-side critical sections. These variants of RCU detect grace periods by sampling these counters.”…””}”(hj3hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h K)hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëhhèhžhhŸh¯h Nubhì)”}”(hŒ™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? See UP.rst for more information. ”h]”(hÆ)”}”(hŒvIf I am running on a uniprocessor kernel, which can only do one thing at a time, why should I wait for a grace period?”h]”hŒvIf I am running on a uniprocessor kernel, which can only do one thing at a time, why should I wait for a grace period?”…””}”(hjKhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h K1hjGubhÆ)”}”(hŒ See UP.rst for more information.”h]”hŒ See UP.rst for more information.”…””}”(hjYhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h K4hjGubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëhhèhžhhŸh¯h Nubhì)”}”(hX”How can I see where RCU is currently used in the Linux kernel? Search for "rcu_read_lock", "rcu_read_unlock", "call_rcu", "rcu_read_lock_bh", "rcu_read_unlock_bh", "srcu_read_lock", "srcu_read_unlock", "synchronize_rcu", "synchronize_net", "synchronize_srcu", and the other RCU primitives. Or grab one of the cscope databases from: (http://www.rdrop.com/users/paulmck/RCU/linuxusage/rculocktab.html). ”h]”(hÆ)”}”(hŒ>How can I see where RCU is currently used in the Linux kernel?”h]”hŒ>How can I see where RCU is currently used in the Linux kernel?”…””}”(hjqhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h K6hjmubhÆ)”}”(hX Search for "rcu_read_lock", "rcu_read_unlock", "call_rcu", "rcu_read_lock_bh", "rcu_read_unlock_bh", "srcu_read_lock", "srcu_read_unlock", "synchronize_rcu", "synchronize_net", "synchronize_srcu", and the other RCU primitives. Or grab one of the cscope databases from:”h]”hX5Search for “rcu_read_lockâ€, “rcu_read_unlockâ€, “call_rcuâ€, “rcu_read_lock_bhâ€, “rcu_read_unlock_bhâ€, “srcu_read_lockâ€, “srcu_read_unlockâ€, “synchronize_rcuâ€, “synchronize_netâ€, “synchronize_srcuâ€, and the other RCU primitives. Or grab one of the cscope databases from:”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h K8hjmubhÆ)”}”(hŒD(http://www.rdrop.com/users/paulmck/RCU/linuxusage/rculocktab.html).”h]”(hŒ(”…””}”(hjhžhhŸNh NubhŒ reference”“”)”}”(hŒAhttp://www.rdrop.com/users/paulmck/RCU/linuxusage/rculocktab.html”h]”hŒAhttp://www.rdrop.com/users/paulmck/RCU/linuxusage/rculocktab.html”…””}”(hj—hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j™uh1j•hjubhŒ).”…””}”(hjhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h K>hjmubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëhhèhžhhŸh¯h Nubhì)”}”(hŒUWhat guidelines should I follow when writing code that uses RCU? See checklist.rst. ”h]”(hÆ)”}”(hŒ@What guidelines should I follow when writing code that uses RCU?”h]”hŒ@What guidelines should I follow when writing code that uses RCU?”…””}”(hjºhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h K@hj¶ubhÆ)”}”(hŒSee checklist.rst.”h]”hŒSee checklist.rst.”…””}”(hjÈhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h KBhj¶ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëhhèhžhhŸh¯h Nubhì)”}”(hŒ£Why the name "RCU"? "RCU" stands for "read-copy update". listRCU.rst has more information on where this name came from, search for "read-copy update" to find it. ”h]”(hÆ)”}”(hŒWhy the name "RCU"?”h]”hŒWhy the name “RCUâ€?”…””}”(hjàhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h KDhjÜubhÆ)”}”(hŒ"RCU" stands for "read-copy update". listRCU.rst has more information on where this name came from, search for "read-copy update" to find it.”h]”hŒ™â€œRCU†stands for “read-copy updateâ€. listRCU.rst has more information on where this name came from, search for “read-copy update†to find it.”…””}”(hjîhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h KFhjÜubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëhhèhžhhŸh¯h Nubhì)”}”(hXºI hear that RCU is patented? What is with that? Yes, it is. There are several known patents related to RCU, search for the string "Patent" in Documentation/RCU/RTFP.txt to find them. Of these, one was allowed to lapse by the assignee, and the others have been contributed to the Linux kernel under GPL. Many (but not all) have long since expired. There are now also LGPL implementations of user-level RCU available (https://liburcu.org/). ”h]”(hÆ)”}”(hŒ0I hear that RCU is patented? What is with that?”h]”hŒ0I hear that RCU is patented? What is with that?”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h KJhjubhÆ)”}”(hX‡Yes, it is. There are several known patents related to RCU, search for the string "Patent" in Documentation/RCU/RTFP.txt to find them. Of these, one was allowed to lapse by the assignee, and the others have been contributed to the Linux kernel under GPL. Many (but not all) have long since expired. There are now also LGPL implementations of user-level RCU available (https://liburcu.org/).”h]”(hXuYes, it is. There are several known patents related to RCU, search for the string “Patent†in Documentation/RCU/RTFP.txt to find them. Of these, one was allowed to lapse by the assignee, and the others have been contributed to the Linux kernel under GPL. Many (but not all) have long since expired. There are now also LGPL implementations of user-level RCU available (”…””}”(hjhžhhŸNh Nubj–)”}”(hŒhttps://liburcu.org/”h]”hŒhttps://liburcu.org/”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”juh1j•hjubhŒ).”…””}”(hjhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h KLhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëhhèhžhhŸh¯h Nubhì)”}”(hŒžI hear that RCU needs work in order to support realtime kernels? Realtime-friendly RCU are enabled via the CONFIG_PREEMPTION kernel configuration parameter. ”h]”(hÆ)”}”(hŒ@I hear that RCU needs work in order to support realtime kernels?”h]”hŒ@I hear that RCU needs work in order to support realtime kernels?”…””}”(hj?hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h KThj;ubhÆ)”}”(hŒ[Realtime-friendly RCU are enabled via the CONFIG_PREEMPTION kernel configuration parameter.”h]”hŒ[Realtime-friendly RCU are enabled via the CONFIG_PREEMPTION kernel configuration parameter.”…””}”(hjMhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h KVhj;ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëhhèhžhhŸh¯h Nubhì)”}”(hX*Where can I find more information on RCU? See the Documentation/RCU/RTFP.txt file. Or point your browser at (https://docs.google.com/document/d/1X0lThx8OK0ZgLMqVoXiR4ZrGURHrXK6NyLRbeXe3Xac/edit) or (https://docs.google.com/document/d/1GCdQC8SDbb54W1shjEXqGZ0Rq8a6kIeYutdSIajfpLA/edit?usp=sharing).”h]”(hÆ)”}”(hŒ)Where can I find more information on RCU?”h]”hŒ)Where can I find more information on RCU?”…””}”(hjehžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h KYhjaubhÆ)”}”(hŒÿSee the Documentation/RCU/RTFP.txt file. Or point your browser at (https://docs.google.com/document/d/1X0lThx8OK0ZgLMqVoXiR4ZrGURHrXK6NyLRbeXe3Xac/edit) or (https://docs.google.com/document/d/1GCdQC8SDbb54W1shjEXqGZ0Rq8a6kIeYutdSIajfpLA/edit?usp=sharing).”h]”(hŒCSee the Documentation/RCU/RTFP.txt file. Or point your browser at (”…””}”(hjshžhhŸNh Nubj–)”}”(hŒThttps://docs.google.com/document/d/1X0lThx8OK0ZgLMqVoXiR4ZrGURHrXK6NyLRbeXe3Xac/edit”h]”hŒThttps://docs.google.com/document/d/1X0lThx8OK0ZgLMqVoXiR4ZrGURHrXK6NyLRbeXe3Xac/edit”…””}”(hj{hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j}uh1j•hjsubhŒ) or (”…””}”(hjshžhhŸNh Nubj–)”}”(hŒ`https://docs.google.com/document/d/1GCdQC8SDbb54W1shjEXqGZ0Rq8a6kIeYutdSIajfpLA/edit?usp=sharing”h]”hŒ`https://docs.google.com/document/d/1GCdQC8SDbb54W1shjEXqGZ0Rq8a6kIeYutdSIajfpLA/edit?usp=sharing”…””}”(hjŽhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”juh1j•hjsubhŒ).”…””}”(hjshžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÅhŸh¯h K[hjaubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëhhèhžhhŸh¯h Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1hæhŸh¯h KhhÕhžhubeh}”(h]”Œfrequently-asked-questions”ah ]”h"]”Œfrequently asked questions”ah$]”h&]”uh1h°hh²hžhhŸh¯h Kubeh}”(h]”(Œ rcu-concepts”h®eh ]”h"]”(Œ rcu concepts”Œrcu_doc”eh$]”h&]”uh1h°hhhžhhŸh¯h KŒexpect_referenced_by_name”}”jÃh£sŒexpect_referenced_by_id”}”h®h£subeh}”(h]”h ]”h"]”h$]”h&]”Œsource”h¯uh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hµNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jíŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”h¯Œ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”h®]”h£asŒnameids”}”(jÃh®jÂj¿jºj·uŒ nametypes”}”(jÈj‰jº‰uh}”(h®h²j¿h²j·hÕuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”hŒsystem_message”“”)”}”(hhh]”hÆ)”}”(hhh]”hŒ-Hyperlink target "rcu-doc" is not referenced.”…””}”hjWsbah}”(h]”h ]”h"]”h$]”h&]”uh1hÅhjTubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”h¯Œline”Kuh1jRubaŒ transformer”NŒ include_log”]”Œ decoration”Nhžhub.