€•Å,Œ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/mm/swap-table”Œ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/mm/swap-table”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/it_IT/mm/swap-table”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/ja_JP/mm/swap-table”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/ko_KR/mm/swap-table”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/pt_BR/mm/swap-table”Œ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/mm/swap-table”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³Œ;/var/lib/git/docbuild/linux/Documentation/mm/swap-table.rst”h´KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ Swap Table”h]”hŒ Swap Table”…””}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒ paragraph”“”)”}”(hŒISwap table implements swap cache as a per-cluster swap cache value array.”h]”hŒISwap table implements swap cache as a per-cluster swap cache value array.”…””}”(hhßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K hhÊh²hubhÉ)”}”(hhh]”(hÎ)”}”(hŒ Swap Entry”h]”hŒ Swap Entry”…””}”(hhðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhíh²hh³hÇh´K ubhÞ)”}”(hŒQA swap entry contains the information required to serve the anonymous page fault.”h]”hŒQA swap entry contains the information required to serve the anonymous page fault.”…””}”(hhþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khhíh²hubhÞ)”}”(hŒ>Swap entry is encoded as two parts: swap type and swap offset.”h]”hŒ>Swap entry is encoded as two parts: swap type and swap offset.”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khhíh²hubhÞ)”}”(hŒ|The swap type indicates which swap device to use. The swap offset is the offset of the swap file to read the page data from.”h]”hŒ|The swap type indicates which swap device to use. The swap offset is the offset of the swap file to read the page data from.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khhíh²hubeh}”(h]”Œ swap-entry”ah ]”h"]”Œ swap entry”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K ubhÉ)”}”(hhh]”(hÎ)”}”(hŒ Swap Cache”h]”hŒ Swap Cache”…””}”(hj3h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj0h²hh³hÇh´KubhÞ)”}”(hŒ¥Swap cache is a map to look up folios using swap entry as the key. The result value can have three possible types depending on which stage of this swap entry was in.”h]”hŒ¥Swap cache is a map to look up folios using swap entry as the key. The result value can have three possible types depending on which stage of this swap entry was in.”…””}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khj0h²hubhŒenumerated_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ#NULL: This swap entry is not used. ”h]”hÞ)”}”(hŒ"NULL: This swap entry is not used.”h]”hŒ"NULL: This swap entry is not used.”…””}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhjVubah}”(h]”h ]”h"]”h$]”h&]”uh1jThjQh²hh³hÇh´NubjU)”}”(hŒ®folio: A folio has been allocated and bound to this swap entry. This is the transient state of swap out or swap in. The folio data can be in the folio or swap file, or both. ”h]”hÞ)”}”(hŒ­folio: A folio has been allocated and bound to this swap entry. This is the transient state of swap out or swap in. The folio data can be in the folio or swap file, or both.”h]”hŒ­folio: A folio has been allocated and bound to this swap entry. This is the transient state of swap out or swap in. The folio data can be in the folio or swap file, or both.”…””}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjnubah}”(h]”h ]”h"]”h$]”h&]”uh1jThjQh²hh³hÇh´NubjU)”}”(hŒƒshadow: The shadow contains the working set information of the swapped out folio. This is the normal state for a swapped out page. ”h]”hÞ)”}”(hŒ‚shadow: The shadow contains the working set information of the swapped out folio. This is the normal state for a swapped out page.”h]”hŒ‚shadow: The shadow contains the working set information of the swapped out folio. This is the normal state for a swapped out page.”…””}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K#hj†ubah}”(h]”h ]”h"]”h$]”h&]”uh1jThjQh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ.”uh1jOhj0h²hh³hÇh´Kubeh}”(h]”Œ swap-cache”ah ]”h"]”Œ swap cache”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)”}”(hhh]”(hÎ)”}”(hŒSwap Table Internals”h]”hŒSwap Table Internals”…””}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj±h²hh³hÇh´K'ubhÞ)”}”(hŒThe previous swap cache is implemented by XArray. The XArray is a tree structure. Each lookup will go through multiple nodes. Can we do better?”h]”hŒThe previous swap cache is implemented by XArray. The XArray is a tree structure. Each lookup will go through multiple nodes. Can we do better?”…””}”(hjÂh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K)hj±h²hubhÞ)”}”(hŒ±Notice that most of the time when we look up the swap cache, we are either in a swap in or swap out path. We should already have the swap cluster, which contains the swap entry.”h]”hŒ±Notice that most of the time when we look up the swap cache, we are either in a swap in or swap out path. We should already have the swap cluster, which contains the swap entry.”…””}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K,hj±h²hubhÞ)”}”(hŒIf we have a per-cluster array to store swap cache value in the cluster. Swap cache lookup within the cluster can be a very simple array lookup.”h]”hŒIf we have a per-cluster array to store swap cache value in the cluster. Swap cache lookup within the cluster can be a very simple array lookup.”…””}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K0hj±h²hubhÞ)”}”(hŒIWe give such a per-cluster swap cache value array a name: the swap table.”h]”hŒIWe give such a per-cluster swap cache value array a name: the swap table.”…””}”(hjìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K3hj±h²hubhÞ)”}”(hŒËA swap table is an array of pointers. Each pointer is the same size as a PTE. The size of a swap table for one swap cluster typically matches a PTE page table, which is one page on modern 64-bit systems.”h]”hŒËA swap table is an array of pointers. Each pointer is the same size as a PTE. The size of a swap table for one swap cluster typically matches a PTE page table, which is one page on modern 64-bit systems.”…””}”(hjúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K5hj±h²hubhÞ)”}”(hŒSWith swap table, swap cache lookup can achieve great locality, simpler, and faster.”h]”hŒSWith swap table, swap cache lookup can achieve great locality, simpler, and faster.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K9hj±h²hubeh}”(h]”Œswap-table-internals”ah ]”h"]”Œswap table internals”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K'ubhÉ)”}”(hhh]”(hÎ)”}”(hŒLocking”h]”hŒLocking”…””}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´K=ubhÞ)”}”(hŒéSwap table modification requires taking the cluster lock. If a folio is being added to or removed from the swap table, the folio must be locked prior to the cluster lock. After adding or removing is done, the folio shall be unlocked.”h]”hŒéSwap table modification requires taking the cluster lock. If a folio is being added to or removed from the swap table, the folio must be locked prior to the cluster lock. After adding or removing is done, the folio shall be unlocked.”…””}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K?hjh²hubhÞ)”}”(hŒ~Swap table lookup is protected by RCU and atomic read. If the lookup returns a folio, the user must lock the folio before use.”h]”hŒ~Swap table lookup is protected by RCU and atomic read. If the lookup returns a folio, the user must lock the folio before use.”…””}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KDhjh²hubeh}”(h]”Œlocking”ah ]”h"]”Œlocking”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K=ubeh}”(h]”Œ swap-table”ah ]”h"]”Œ swap table”ah$]”h&]”uh1hÈhhh²hh³hÇh´Kubeh}”(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”}”Œnameids”}”(jXjUj-j*j®j«jjjPjMuŒ nametypes”}”(jX‰j-‰j®‰j‰jP‰uh}”(jUhÊj*híj«j0jj±jMjuŒ 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”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.