€•õ+Œ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Œ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.”…””}”(hhø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”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjhž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.”…””}”(hj-hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khjhž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.”…””}”(hjFhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhjBubah}”(h]”h ]”h"]”h$]”h&]”uh1j@hj=hžhhŸh³h NubjA)”}”(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.”…””}”(hj^hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhjZubah}”(h]”h ]”h"]”h$]”h&]”uh1j@hj=hžhhŸh³h NubjA)”}”(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.”…””}”(hjvhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K#hjrubah}”(h]”h ]”h"]”h$]”h&]”uh1j@hj=hžhhŸh³h Nubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ.”uh1j;hjhž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¹hjhž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)hjhž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,hjhž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 K0hjhž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 K3hjhž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 K5hjhž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.”…””}”(hjôhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K9hjhž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¹hj hž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.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K?hj hž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 KDhj hž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”jjŒ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”}”(jDjAjjjšj—jjj<j9uŒ nametypes”}”(jD‰j‰jš‰j‰j<‰uh}”(jAh¶jhÙj—jjjj9j 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”]”Œ transformer”NŒ include_log”]”Œ decoration”Nhžhub.