sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget&/translations/zh_CN/mm/physical_memorymodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/zh_TW/mm/physical_memorymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/it_IT/mm/physical_memorymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/ja_JP/mm/physical_memorymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/ko_KR/mm/physical_memorymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/sp_SP/mm/physical_memorymodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh@/var/lib/git/docbuild/linux/Documentation/mm/physical_memory.rsthKubhsection)}(hhh](htitle)}(hPhysical Memoryh]hPhysical Memory}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hLinux is available for a wide range of architectures so there is a need for an architecture-independent abstraction to represent the physical memory. This chapter describes the structures used to manage physical memory in a running system.h]hLinux is available for a wide range of architectures so there is a need for an architecture-independent abstraction to represent the physical memory. This chapter describes the structures used to manage physical memory in a running system.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXThe first principal concept prevalent in the memory management is `Non-Uniform Memory Access (NUMA) `_. With multi-core and multi-socket machines, memory may be arranged into banks that incur a different cost to access depending on the “distance” from the processor. For example, there might be a bank of memory assigned to each CPU or a bank of memory very suitable for DMA near peripheral devices.h](hBThe first principal concept prevalent in the memory management is }(hhhhhNhNubh reference)}(h]`Non-Uniform Memory Access (NUMA) `_h]h Non-Uniform Memory Access (NUMA)}(hhhhhNhNubah}(h]h ]h"]h$]h&]name Non-Uniform Memory Access (NUMA)refuri7https://en.wikipedia.org/wiki/Non-uniform_memory_accessuh1hhhubhtarget)}(h: h]h}(h]non-uniform-memory-access-numaah ]h"] non-uniform memory access (numa)ah$]h&]refurihuh1h referencedKhhubhX-. With multi-core and multi-socket machines, memory may be arranged into banks that incur a different cost to access depending on the “distance” from the processor. For example, there might be a bank of memory assigned to each CPU or a bank of memory very suitable for DMA near peripheral devices.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hXHEach bank is called a node and the concept is represented under Linux by a ``struct pglist_data`` even if the architecture is UMA. This structure is always referenced by its typedef ``pg_data_t``. A ``pg_data_t`` structure for a particular node can be referenced by ``NODE_DATA(nid)`` macro where ``nid`` is the ID of that node.h](hKEach bank is called a node and the concept is represented under Linux by a }(hjhhhNhNubhliteral)}(h``struct pglist_data``h]hstruct pglist_data}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhU even if the architecture is UMA. This structure is always referenced by its typedef }(hjhhhNhNubj)}(h ``pg_data_t``h]h pg_data_t}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh. A }(hjhhhNhNubj)}(h ``pg_data_t``h]h pg_data_t}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh6 structure for a particular node can be referenced by }(hjhhhNhNubj)}(h``NODE_DATA(nid)``h]hNODE_DATA(nid)}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh macro where }(hjhhhNhNubj)}(h``nid``h]hnid}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is the ID of that node.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXeFor NUMA architectures, the node structures are allocated by the architecture specific code early during boot. Usually, these structures are allocated locally on the memory bank they represent. For UMA architectures, only one static ``pg_data_t`` structure called ``contig_page_data`` is used. Nodes will be discussed further in Section :ref:`Nodes `h](hFor NUMA architectures, the node structures are allocated by the architecture specific code early during boot. Usually, these structures are allocated locally on the memory bank they represent. For UMA architectures, only one static }(hjyhhhNhNubj)}(h ``pg_data_t``h]h pg_data_t}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjyubh structure called }(hjyhhhNhNubj)}(h``contig_page_data``h]hcontig_page_data}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjyubh5 is used. Nodes will be discussed further in Section }(hjyhhhNhNubh)}(h:ref:`Nodes `h]hinline)}(hjh]hNodes}(hjhhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocmm/physical_memory refdomainjreftyperef refexplicitrefwarn reftargetnodesuh1hhhhKhjyubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXwThe entire physical address space is partitioned into one or more blocks called zones which represent ranges within memory. These ranges are usually determined by architectural constraints for accessing the physical memory. The memory range within a node that corresponds to a particular zone is described by a ``struct zone``. Each zone has one of the types described below.h](hX7The entire physical address space is partitioned into one or more blocks called zones which represent ranges within memory. These ranges are usually determined by architectural constraints for accessing the physical memory. The memory range within a node that corresponds to a particular zone is described by a }(hjhhhNhNubj)}(h``struct zone``h]h struct zone}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh1. Each zone has one of the types described below.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh bullet_list)}(hhh](h list_item)}(hX``ZONE_DMA`` and ``ZONE_DMA32`` historically represented memory suitable for DMA by peripheral devices that cannot access all of the addressable memory. For many years there are better more and robust interfaces to get memory with DMA specific requirements (Documentation/core-api/dma-api.rst), but ``ZONE_DMA`` and ``ZONE_DMA32`` still represent memory ranges that have restrictions on how they can be accessed. Depending on the architecture, either of these zone types or even they both can be disabled at build time using ``CONFIG_ZONE_DMA`` and ``CONFIG_ZONE_DMA32`` configuration options. Some 64-bit platforms may need both zones as they support peripherals with different DMA addressing limitations. h]h)}(hX``ZONE_DMA`` and ``ZONE_DMA32`` historically represented memory suitable for DMA by peripheral devices that cannot access all of the addressable memory. For many years there are better more and robust interfaces to get memory with DMA specific requirements (Documentation/core-api/dma-api.rst), but ``ZONE_DMA`` and ``ZONE_DMA32`` still represent memory ranges that have restrictions on how they can be accessed. Depending on the architecture, either of these zone types or even they both can be disabled at build time using ``CONFIG_ZONE_DMA`` and ``CONFIG_ZONE_DMA32`` configuration options. Some 64-bit platforms may need both zones as they support peripherals with different DMA addressing limitations.h](j)}(h ``ZONE_DMA``h]hZONE_DMA}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h``ZONE_DMA32``h]h ZONE_DMA32}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhX  historically represented memory suitable for DMA by peripheral devices that cannot access all of the addressable memory. For many years there are better more and robust interfaces to get memory with DMA specific requirements (Documentation/core-api/dma-api.rst), but }(hjhhhNhNubj)}(h ``ZONE_DMA``h]hZONE_DMA}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }hjsbj)}(h``ZONE_DMA32``h]h ZONE_DMA32}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh still represent memory ranges that have restrictions on how they can be accessed. Depending on the architecture, either of these zone types or even they both can be disabled at build time using }(hjhhhNhNubj)}(h``CONFIG_ZONE_DMA``h]hCONFIG_ZONE_DMA}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h``CONFIG_ZONE_DMA32``h]hCONFIG_ZONE_DMA32}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh configuration options. Some 64-bit platforms may need both zones as they support peripherals with different DMA addressing limitations.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK'hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h``ZONE_NORMAL`` is for normal memory that can be accessed by the kernel all the time. DMA operations can be performed on pages in this zone if the DMA devices support transfers to all addressable memory. ``ZONE_NORMAL`` is always enabled. h]h)}(h``ZONE_NORMAL`` is for normal memory that can be accessed by the kernel all the time. DMA operations can be performed on pages in this zone if the DMA devices support transfers to all addressable memory. ``ZONE_NORMAL`` is always enabled.h](j)}(h``ZONE_NORMAL``h]h ZONE_NORMAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj{ubh is for normal memory that can be accessed by the kernel all the time. DMA operations can be performed on pages in this zone if the DMA devices support transfers to all addressable memory. }(hj{hhhNhNubj)}(h``ZONE_NORMAL``h]h ZONE_NORMAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj{ubh is always enabled.}(hj{hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK3hjwubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hX.``ZONE_HIGHMEM`` is the part of the physical memory that is not covered by a permanent mapping in the kernel page tables. The memory in this zone is only accessible to the kernel using temporary mappings. This zone is available only on some 32-bit architectures and is enabled with ``CONFIG_HIGHMEM``. h]h)}(hX-``ZONE_HIGHMEM`` is the part of the physical memory that is not covered by a permanent mapping in the kernel page tables. The memory in this zone is only accessible to the kernel using temporary mappings. This zone is available only on some 32-bit architectures and is enabled with ``CONFIG_HIGHMEM``.h](j)}(h``ZONE_HIGHMEM``h]h ZONE_HIGHMEM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhX  is the part of the physical memory that is not covered by a permanent mapping in the kernel page tables. The memory in this zone is only accessible to the kernel using temporary mappings. This zone is available only on some 32-bit architectures and is enabled with }(hjhhhNhNubj)}(h``CONFIG_HIGHMEM``h]hCONFIG_HIGHMEM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK8hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hXT``ZONE_MOVABLE`` is for normal accessible memory, just like ``ZONE_NORMAL``. The difference is that the contents of most pages in ``ZONE_MOVABLE`` is movable. That means that while virtual addresses of these pages do not change, their content may move between different physical pages. Often ``ZONE_MOVABLE`` is populated during memory hotplug, but it may be also populated on boot using one of ``kernelcore``, ``movablecore`` and ``movable_node`` kernel command line parameters. See Documentation/mm/page_migration.rst and Documentation/admin-guide/mm/memory-hotplug.rst for additional details. h]h)}(hXS``ZONE_MOVABLE`` is for normal accessible memory, just like ``ZONE_NORMAL``. The difference is that the contents of most pages in ``ZONE_MOVABLE`` is movable. That means that while virtual addresses of these pages do not change, their content may move between different physical pages. Often ``ZONE_MOVABLE`` is populated during memory hotplug, but it may be also populated on boot using one of ``kernelcore``, ``movablecore`` and ``movable_node`` kernel command line parameters. See Documentation/mm/page_migration.rst and Documentation/admin-guide/mm/memory-hotplug.rst for additional details.h](j)}(h``ZONE_MOVABLE``h]h ZONE_MOVABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, is for normal accessible memory, just like }(hjhhhNhNubj)}(h``ZONE_NORMAL``h]h ZONE_NORMAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh7. The difference is that the contents of most pages in }(hjhhhNhNubj)}(h``ZONE_MOVABLE``h]h ZONE_MOVABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is movable. That means that while virtual addresses of these pages do not change, their content may move between different physical pages. Often }(hjhhhNhNubj)}(h``ZONE_MOVABLE``h]h ZONE_MOVABLE}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhW is populated during memory hotplug, but it may be also populated on boot using one of }(hjhhhNhNubj)}(h``kernelcore``h]h kernelcore}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(hjhhhNhNubj)}(h``movablecore``h]h movablecore}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h``movable_node``h]h movable_node}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh kernel command line parameters. See Documentation/mm/page_migration.rst and Documentation/admin-guide/mm/memory-hotplug.rst for additional details.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK=hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hXP``ZONE_DEVICE`` represents memory residing on devices such as PMEM and GPU. It has different characteristics than RAM zone types and it exists to provide :ref:`struct page ` and memory map services for device driver identified physical address ranges. ``ZONE_DEVICE`` is enabled with configuration option ``CONFIG_ZONE_DEVICE``. h]h)}(hXO``ZONE_DEVICE`` represents memory residing on devices such as PMEM and GPU. It has different characteristics than RAM zone types and it exists to provide :ref:`struct page ` and memory map services for device driver identified physical address ranges. ``ZONE_DEVICE`` is enabled with configuration option ``CONFIG_ZONE_DEVICE``.h](j)}(h``ZONE_DEVICE``h]h ZONE_DEVICE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj}ubh represents memory residing on devices such as PMEM and GPU. It has different characteristics than RAM zone types and it exists to provide }(hj}hhhNhNubh)}(h:ref:`struct page `h]j)}(hjh]h struct page}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjpagesuh1hhhhKGhj}ubhO and memory map services for device driver identified physical address ranges. }(hj}hhhNhNubj)}(h``ZONE_DEVICE``h]h ZONE_DEVICE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj}ubh& is enabled with configuration option }(hj}hhhNhNubj)}(h``CONFIG_ZONE_DEVICE``h]hCONFIG_ZONE_DEVICE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj}ubh.}(hj}hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKGhjyubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]bullet*uh1jhhhK'hhhhubh)}(hIt is important to note that many kernel operations can only take place using ``ZONE_NORMAL`` so it is the most performance critical zone. Zones are discussed further in Section :ref:`Zones `.h](hNIt is important to note that many kernel operations can only take place using }(hjhhhNhNubj)}(h``ZONE_NORMAL``h]h ZONE_NORMAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhU so it is the most performance critical zone. Zones are discussed further in Section }(hjhhhNhNubh)}(h:ref:`Zones `h]j)}(hj h]hZones}(hj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjzonesuh1hhhhKMhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKMhhhhubh)}(hThe relation between node and zone extents is determined by the physical memory map reported by the firmware, architectural constraints for memory addressing and certain parameters in the kernel command line.h]hThe relation between node and zone extents is determined by the physical memory map reported by the firmware, architectural constraints for memory addressing and certain parameters in the kernel command line.}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKQhhhhubh)}(hFor example, with 32-bit kernel on an x86 UMA machine with 2 Gbytes of RAM the entire memory will be on node 0 and there will be three zones: ``ZONE_DMA``, ``ZONE_NORMAL`` and ``ZONE_HIGHMEM``::h](hFor example, with 32-bit kernel on an x86 UMA machine with 2 Gbytes of RAM the entire memory will be on node 0 and there will be three zones: }(hjAhhhNhNubj)}(h ``ZONE_DMA``h]hZONE_DMA}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjAubh, }(hjAhhhNhNubj)}(h``ZONE_NORMAL``h]h ZONE_NORMAL}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjAubh and }(hjAhhhNhNubj)}(h``ZONE_HIGHMEM``h]h ZONE_HIGHMEM}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjAubh:}(hjAhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKUhhhhubh literal_block)}(hX0 2G +-------------------------------------------------------------+ | node 0 | +-------------------------------------------------------------+ 0 16M 896M 2G +----------+-----------------------+--------------------------+ | ZONE_DMA | ZONE_NORMAL | ZONE_HIGHMEM | +----------+-----------------------+--------------------------+h]hX0 2G +-------------------------------------------------------------+ | node 0 | +-------------------------------------------------------------+ 0 16M 896M 2G +----------+-----------------------+--------------------------+ | ZONE_DMA | ZONE_NORMAL | ZONE_HIGHMEM | +----------+-----------------------+--------------------------+}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKYhhhhubh)}(hXEWith a kernel built with ``ZONE_DMA`` disabled and ``ZONE_DMA32`` enabled and booted with ``movablecore=80%`` parameter on an arm64 machine with 16 Gbytes of RAM equally split between two nodes, there will be ``ZONE_DMA32``, ``ZONE_NORMAL`` and ``ZONE_MOVABLE`` on node 0, and ``ZONE_NORMAL`` and ``ZONE_MOVABLE`` on node 1::h](hWith a kernel built with }(hjhhhNhNubj)}(h ``ZONE_DMA``h]hZONE_DMA}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh disabled and }(hjhhhNhNubj)}(h``ZONE_DMA32``h]h ZONE_DMA32}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh enabled and booted with }(hjhhhNhNubj)}(h``movablecore=80%``h]hmovablecore=80%}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhd parameter on an arm64 machine with 16 Gbytes of RAM equally split between two nodes, there will be }(hjhhhNhNubj)}(h``ZONE_DMA32``h]h ZONE_DMA32}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(hjhhhNhNubj)}(h``ZONE_NORMAL``h]h ZONE_NORMAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h``ZONE_MOVABLE``h]h ZONE_MOVABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh on node 0, and }(hjhhhNhNubj)}(h``ZONE_NORMAL``h]h ZONE_NORMAL}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h``ZONE_MOVABLE``h]h ZONE_MOVABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh on node 1:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKdhhhhubj)}(hX1G 9G 17G +--------------------------------+ +--------------------------+ | node 0 | | node 1 | +--------------------------------+ +--------------------------+ 1G 4G 4200M 9G 9320M 17G +---------+----------+-----------+ +------------+-------------+ | DMA32 | NORMAL | MOVABLE | | NORMAL | MOVABLE | +---------+----------+-----------+ +------------+-------------+h]hX1G 9G 17G +--------------------------------+ +--------------------------+ | node 0 | | node 1 | +--------------------------------+ +--------------------------+ 1G 4G 4200M 9G 9320M 17G +---------+----------+-----------+ +------------+-------------+ | DMA32 | NORMAL | MOVABLE | | NORMAL | MOVABLE | +---------+----------+-----------+ +------------+-------------+}hj3sbah}(h]h ]h"]h$]h&]hhuh1jhhhKkhhhhubh)}(hMemory banks may belong to interleaving nodes. In the example below an x86 machine has 16 Gbytes of RAM in 4 memory banks, even banks belong to node 0 and odd banks belong to node 1::h]hMemory banks may belong to interleaving nodes. In the example below an x86 machine has 16 Gbytes of RAM in 4 memory banks, even banks belong to node 0 and odd banks belong to node 1:}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKvhhhhubj)}(hX0 4G 8G 12G 16G +-------------+ +-------------+ +-------------+ +-------------+ | node 0 | | node 1 | | node 0 | | node 1 | +-------------+ +-------------+ +-------------+ +-------------+ 0 16M 4G +-----+-------+ +-------------+ +-------------+ +-------------+ | DMA | DMA32 | | NORMAL | | NORMAL | | NORMAL | +-----+-------+ +-------------+ +-------------+ +-------------+h]hX0 4G 8G 12G 16G +-------------+ +-------------+ +-------------+ +-------------+ | node 0 | | node 1 | | node 0 | | node 1 | +-------------+ +-------------+ +-------------+ +-------------+ 0 16M 4G +-----+-------+ +-------------+ +-------------+ +-------------+ | DMA | DMA32 | | NORMAL | | NORMAL | | NORMAL | +-----+-------+ +-------------+ +-------------+ +-------------+}hjOsbah}(h]h ]h"]h$]h&]hhuh1jhhhK{hhhhubh)}(h[In this case node 0 will span from 0 to 12 Gbytes and node 1 will span from 4 to 16 Gbytes.h]h[In this case node 0 will span from 0 to 12 Gbytes and node 1 will span from 4 to 16 Gbytes.}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h .. _nodes:h]h}(h]h ]h"]h$]h&]refidnodesuh1hhKhhhhhhubh)}(hhh](h)}(hNodesh]hNodes}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjwhhhhhKubh)}(hXAs we have mentioned, each node in memory is described by a ``pg_data_t`` which is a typedef for a ``struct pglist_data``. When allocating a page, by default Linux uses a node-local allocation policy to allocate memory from the node closest to the running CPU. As processes tend to run on the same CPU, it is likely the memory from the current node will be used. The allocation policy can be controlled by users as described in Documentation/admin-guide/mm/numa_memory_policy.rst.h](h`.h](hXeMost NUMA architectures maintain an array of pointers to the node structures. The actual structures are allocated early during boot when architecture specific code parses the physical memory map reported by the firmware. The bulk of the node initialization happens slightly later in the boot process by free_area_init() function, described later in Section }(hjhhhNhNubh)}(h&:ref:`Initialization `h]j)}(hjh]hInitialization}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjinitializationuh1hhhhKhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(hAlong with the node structures, kernel maintains an array of ``nodemask_t`` bitmasks called ``node_states``. Each bitmask in this array represents a set of nodes with particular properties as defined by ``enum node_states``:h](h=Along with the node structures, kernel maintains an array of }(hjhhhNhNubj)}(h``nodemask_t``h]h nodemask_t}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh bitmasks called }(hjhhhNhNubj)}(h``node_states``h]h node_states}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh`. Each bitmask in this array represents a set of nodes with particular properties as defined by }(hjhhhNhNubj)}(h``enum node_states``h]henum node_states}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubhdefinition_list)}(hhh](hdefinition_list_item)}(h:``N_POSSIBLE`` The node could become online at some point.h](hterm)}(h``N_POSSIBLE``h]j)}(hj?h]h N_POSSIBLE}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj=ubah}(h]h ]h"]h$]h&]uh1j;hhhKhj7ubh definition)}(hhh]h)}(h+The node could become online at some point.h]h+The node could become online at some point.}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjVubah}(h]h ]h"]h$]h&]uh1jThj7ubeh}(h]h ]h"]h$]h&]uh1j5hhhKhj2ubj6)}(h ``N_ONLINE`` The node is online.h](j<)}(h ``N_ONLINE``h]j)}(hjyh]hN_ONLINE}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubah}(h]h ]h"]h$]h&]uh1j;hhhKhjsubjU)}(hhh]h)}(hThe node is online.h]hThe node is online.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jThjsubeh}(h]h ]h"]h$]h&]uh1j5hhhKhj2hhubj6)}(h0``N_NORMAL_MEMORY`` The node has regular memory.h](j<)}(h``N_NORMAL_MEMORY``h]j)}(hjh]hN_NORMAL_MEMORY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhKhjubjU)}(hhh]h)}(hThe node has regular memory.h]hThe node has regular memory.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhKhj2hhubj6)}(hz``N_HIGH_MEMORY`` The node has regular or high memory. When ``CONFIG_HIGHMEM`` is disabled aliased to ``N_NORMAL_MEMORY``.h](j<)}(h``N_HIGH_MEMORY``h]j)}(hjh]h N_HIGH_MEMORY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhKhjubjU)}(hhh]h)}(hhThe node has regular or high memory. When ``CONFIG_HIGHMEM`` is disabled aliased to ``N_NORMAL_MEMORY``.h](h*The node has regular or high memory. When }(hjhhhNhNubj)}(h``CONFIG_HIGHMEM``h]hCONFIG_HIGHMEM}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is disabled aliased to }(hjhhhNhNubj)}(h``N_NORMAL_MEMORY``h]hN_NORMAL_MEMORY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhKhj2hhubj6)}(h8``N_MEMORY`` The node has memory(regular, high, movable)h](j<)}(h ``N_MEMORY``h]j)}(hjEh]hN_MEMORY}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjCubah}(h]h ]h"]h$]h&]uh1j;hhhKhj?ubjU)}(hhh]h)}(h+The node has memory(regular, high, movable)h]h+The node has memory(regular, high, movable)}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjZubah}(h]h ]h"]h$]h&]uh1jThj?ubeh}(h]h ]h"]h$]h&]uh1j5hhhKhj2hhubj6)}(h(``N_CPU`` The node has one or more CPUs h](j<)}(h ``N_CPU``h]j)}(hj}h]hN_CPU}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj{ubah}(h]h ]h"]h$]h&]uh1j;hhhKhjwubjU)}(hhh]h)}(hThe node has one or more CPUsh]hThe node has one or more CPUs}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jThjwubeh}(h]h ]h"]h$]h&]uh1j5hhhKhj2hhubeh}(h]h ]h"]h$]h&]uh1j0hjwhhhhhNubh)}(hFor each node that has a property described above, the bit corresponding to the node ID in the ``node_states[]`` bitmask is set.h](h_For each node that has a property described above, the bit corresponding to the node ID in the }(hjhhhNhNubj)}(h``node_states[]``h]hnode_states[]}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh bitmask is set.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(hLFor example, for node 2 with normal memory and CPUs, bit 2 will be set in ::h]hIFor example, for node 2 with normal memory and CPUs, bit 2 will be set in}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubj)}(hnode_states[N_POSSIBLE] node_states[N_ONLINE] node_states[N_NORMAL_MEMORY] node_states[N_HIGH_MEMORY] node_states[N_MEMORY] node_states[N_CPU]h]hnode_states[N_POSSIBLE] node_states[N_ONLINE] node_states[N_NORMAL_MEMORY] node_states[N_HIGH_MEMORY] node_states[N_MEMORY] node_states[N_CPU]}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjwhhubh)}(h\For various operations possible with nodemasks please refer to ``include/linux/nodemask.h``.h](h?For various operations possible with nodemasks please refer to }(hjhhhNhNubj)}(h``include/linux/nodemask.h``h]hinclude/linux/nodemask.h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(hAmong other things, nodemasks are used to provide macros for node traversal, namely ``for_each_node()`` and ``for_each_online_node()``.h](hTAmong other things, nodemasks are used to provide macros for node traversal, namely }(hjhhhNhNubj)}(h``for_each_node()``h]hfor_each_node()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h``for_each_online_node()``h]hfor_each_online_node()}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(h=For instance, to call a function foo() for each online node::h]h ubah}(h]h ]h"]h$]h&]uh1j;hhhKhj: ubjU)}(hhh]h)}(h>The page frame number of the starting page frame in this node.h]h>The page frame number of the starting page frame in this node.}(hjX hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjU ubah}(h]h ]h"]h$]h&]uh1jThj: ubeh}(h]h ]h"]h$]h&]uh1j5hhhKhjhhubj6)}(hL``node_present_pages`` Total number of physical pages present in this node. h](j<)}(h``node_present_pages``h]j)}(hjx h]hnode_present_pages}(hjz hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjv ubah}(h]h ]h"]h$]h&]uh1j;hhhKhjr ubjU)}(hhh]h)}(h4Total number of physical pages present in this node.h]h4Total number of physical pages present in this node.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jThjr ubeh}(h]h ]h"]h$]h&]uh1j5hhhKhjhhubj6)}(hK``node_spanned_pages`` Total size of physical page range, including holes. h](j<)}(h``node_spanned_pages``h]j)}(hj h]hnode_spanned_pages}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j;hhhKhj ubjU)}(hhh]h)}(h3Total size of physical page range, including holes.h]h3Total size of physical page range, including holes.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1j5hhhKhjhhubj6)}(hX``node_size_lock`` A lock that protects the fields defining the node extents. Only defined when at least one of ``CONFIG_MEMORY_HOTPLUG`` or ``CONFIG_DEFERRED_STRUCT_PAGE_INIT`` configuration options are enabled. ``pgdat_resize_lock()`` and ``pgdat_resize_unlock()`` are provided to manipulate ``node_size_lock`` without checking for ``CONFIG_MEMORY_HOTPLUG`` or ``CONFIG_DEFERRED_STRUCT_PAGE_INIT``. h](j<)}(h``node_size_lock``h]j)}(hj h]hnode_size_lock}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j;hhhKhj ubjU)}(hhh]h)}(hX}A lock that protects the fields defining the node extents. Only defined when at least one of ``CONFIG_MEMORY_HOTPLUG`` or ``CONFIG_DEFERRED_STRUCT_PAGE_INIT`` configuration options are enabled. ``pgdat_resize_lock()`` and ``pgdat_resize_unlock()`` are provided to manipulate ``node_size_lock`` without checking for ``CONFIG_MEMORY_HOTPLUG`` or ``CONFIG_DEFERRED_STRUCT_PAGE_INIT``.h](h]A lock that protects the fields defining the node extents. Only defined when at least one of }(hj hhhNhNubj)}(h``CONFIG_MEMORY_HOTPLUG``h]hCONFIG_MEMORY_HOTPLUG}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh or }(hj hhhNhNubj)}(h$``CONFIG_DEFERRED_STRUCT_PAGE_INIT``h]h CONFIG_DEFERRED_STRUCT_PAGE_INIT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh$ configuration options are enabled. }(hj hhhNhNubj)}(h``pgdat_resize_lock()``h]hpgdat_resize_lock()}(hj, hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh and }(hj hhhNhNubj)}(h``pgdat_resize_unlock()``h]hpgdat_resize_unlock()}(hj> hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh are provided to manipulate }(hj hhhNhNubj)}(h``node_size_lock``h]hnode_size_lock}(hjP hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh without checking for }(hj hhhNhNubj)}(h``CONFIG_MEMORY_HOTPLUG``h]hCONFIG_MEMORY_HOTPLUG}(hjb hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh or }(hj hhhNhNubj)}(h$``CONFIG_DEFERRED_STRUCT_PAGE_INIT``h]h CONFIG_DEFERRED_STRUCT_PAGE_INIT}(hjt hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1j5hhhKhjhhubj6)}(h8``node_id`` The Node ID (NID) of the node, starts at 0. h](j<)}(h ``node_id``h]j)}(hj h]hnode_id}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j;hhhKhj ubjU)}(hhh]h)}(h+The Node ID (NID) of the node, starts at 0.h]h+The Node ID (NID) of the node, starts at 0.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1j5hhhKhjhhubj6)}(hl``totalreserve_pages`` This is a per-node reserve of pages that are not available to userspace allocations. h](j<)}(h``totalreserve_pages``h]j)}(hj h]htotalreserve_pages}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j;hhhMhj ubjU)}(hhh]h)}(hTThis is a per-node reserve of pages that are not available to userspace allocations.h]hTThis is a per-node reserve of pages that are not available to userspace allocations.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhjhhubj6)}(h``first_deferred_pfn`` If memory initialization on large machines is deferred then this is the first PFN that needs to be initialized. Defined only when ``CONFIG_DEFERRED_STRUCT_PAGE_INIT`` is enabled h](j<)}(h``first_deferred_pfn``h]j)}(hj h]hfirst_deferred_pfn}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j;hhhMhj ubjU)}(hhh]h)}(hIf memory initialization on large machines is deferred then this is the first PFN that needs to be initialized. Defined only when ``CONFIG_DEFERRED_STRUCT_PAGE_INIT`` is enabledh](hIf memory initialization on large machines is deferred then this is the first PFN that needs to be initialized. Defined only when }(hj& hhhNhNubj)}(h$``CONFIG_DEFERRED_STRUCT_PAGE_INIT``h]h CONFIG_DEFERRED_STRUCT_PAGE_INIT}(hj. hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj& ubh is enabled}(hj& hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj# ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhjhhubj6)}(h``deferred_split_queue`` Per-node queue of huge pages that their split was deferred. Defined only when ``CONFIG_TRANSPARENT_HUGEPAGE`` is enabled. h](j<)}(h``deferred_split_queue``h]j)}(hjX h]hdeferred_split_queue}(hjZ hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjV ubah}(h]h ]h"]h$]h&]uh1j;hhhMhjR ubjU)}(hhh]h)}(hyPer-node queue of huge pages that their split was deferred. Defined only when ``CONFIG_TRANSPARENT_HUGEPAGE`` is enabled.h](hNPer-node queue of huge pages that their split was deferred. Defined only when }(hjp hhhNhNubj)}(h``CONFIG_TRANSPARENT_HUGEPAGE``h]hCONFIG_TRANSPARENT_HUGEPAGE}(hjx hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjp ubh is enabled.}(hjp hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjm ubah}(h]h ]h"]h$]h&]uh1jThjR ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhjhhubj6)}(h``__lruvec`` Per-node lruvec holding LRU lists and related parameters. Used only when memory cgroups are disabled. It should not be accessed directly, use ``mem_cgroup_lruvec()`` to look up lruvecs instead. h](j<)}(h ``__lruvec``h]j)}(hj h]h__lruvec}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j;hhhM hj ubjU)}(hhh]h)}(hPer-node lruvec holding LRU lists and related parameters. Used only when memory cgroups are disabled. It should not be accessed directly, use ``mem_cgroup_lruvec()`` to look up lruvecs instead.h](hPer-node lruvec holding LRU lists and related parameters. Used only when memory cgroups are disabled. It should not be accessed directly, use }(hj hhhNhNubj)}(h``mem_cgroup_lruvec()``h]hmem_cgroup_lruvec()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh to look up lruvecs instead.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hj ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1j5hhhM hjhhubeh}(h]h ]h"]h$]h&]uh1j0hjhhhhhNubeh}(h]generalah ]h"]h$]generalah&]uh1hhj_hhhhhKjKubh)}(hhh](h)}(hReclaim controlh]hReclaim control}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(h+See also Documentation/mm/page_reclaim.rst.h]h+See also Documentation/mm/page_reclaim.rst.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj1)}(hhh](j6)}(h6``kswapd`` Per-node instance of kswapd kernel thread. h](j<)}(h ``kswapd``h]j)}(hj h]hkswapd}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j;hhhMhj ubjU)}(hhh]h)}(h*Per-node instance of kswapd kernel thread.h]h*Per-node instance of kswapd kernel thread.}(hj4 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj1 ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj ubj6)}(hk``kswapd_wait``, ``pfmemalloc_wait``, ``reclaim_wait`` Workqueues used to synchronize memory reclaim tasks h](j<)}(h6``kswapd_wait``, ``pfmemalloc_wait``, ``reclaim_wait``h](j)}(h``kswapd_wait``h]h kswapd_wait}(hjV hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjR ubh, }(hjR hhhNhNubj)}(h``pfmemalloc_wait``h]hpfmemalloc_wait}(hjh hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjR ubh, }hjR sbj)}(h``reclaim_wait``h]h reclaim_wait}(hjz hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjR ubeh}(h]h ]h"]h$]h&]uh1j;hhhMhjN ubjU)}(hhh]h)}(h3Workqueues used to synchronize memory reclaim tasksh]h3Workqueues used to synchronize memory reclaim tasks}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jThjN ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj hhubj6)}(h_``nr_writeback_throttled`` Number of tasks that are throttled waiting on dirty pages to clean. h](j<)}(h``nr_writeback_throttled``h]j)}(hj h]hnr_writeback_throttled}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j;hhhMhj ubjU)}(hhh]h)}(hCNumber of tasks that are throttled waiting on dirty pages to clean.h]hCNumber of tasks that are throttled waiting on dirty pages to clean.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj hhubj6)}(h_``nr_reclaim_start`` Number of pages written while reclaim is throttled waiting for writeback. h](j<)}(h``nr_reclaim_start``h]j)}(hj h]hnr_reclaim_start}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j;hhhMhj ubjU)}(hhh]h)}(hINumber of pages written while reclaim is throttled waiting for writeback.h]hINumber of pages written while reclaim is throttled waiting for writeback.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj hhubj6)}(h<``kswapd_order`` Controls the order kswapd tries to reclaim h](j<)}(h``kswapd_order``h]j)}(hj!h]h kswapd_order}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhM!hjubjU)}(hhh]h)}(h*Controls the order kswapd tries to reclaimh]h*Controls the order kswapd tries to reclaim}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM!hj6ubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhM!hj hhubj6)}(hL``kswapd_highest_zoneidx`` The highest zone index to be reclaimed by kswapd h](j<)}(h``kswapd_highest_zoneidx``h]j)}(hjYh]hkswapd_highest_zoneidx}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjWubah}(h]h ]h"]h$]h&]uh1j;hhhM$hjSubjU)}(hhh]h)}(h0The highest zone index to be reclaimed by kswapdh]h0The highest zone index to be reclaimed by kswapd}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM$hjnubah}(h]h ]h"]h$]h&]uh1jThjSubeh}(h]h ]h"]h$]h&]uh1j5hhhM$hj hhubj6)}(hJ``kswapd_failures`` Number of runs kswapd was unable to reclaim any pages h](j<)}(h``kswapd_failures``h]j)}(hjh]hkswapd_failures}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhM'hjubjU)}(hhh]h)}(h5Number of runs kswapd was unable to reclaim any pagesh]h5Number of runs kswapd was unable to reclaim any pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM'hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhM'hj hhubj6)}(h``min_unmapped_pages`` Minimal number of unmapped file backed pages that cannot be reclaimed. Determined by ``vm.min_unmapped_ratio`` sysctl. Only defined when ``CONFIG_NUMA`` is enabled. h](j<)}(h``min_unmapped_pages``h]j)}(hjh]hmin_unmapped_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhM,hjubjU)}(hhh]h)}(hMinimal number of unmapped file backed pages that cannot be reclaimed. Determined by ``vm.min_unmapped_ratio`` sysctl. Only defined when ``CONFIG_NUMA`` is enabled.h](hUMinimal number of unmapped file backed pages that cannot be reclaimed. Determined by }(hjhhhNhNubj)}(h``vm.min_unmapped_ratio``h]hvm.min_unmapped_ratio}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh sysctl. Only defined when }(hjhhhNhNubj)}(h``CONFIG_NUMA``h]h CONFIG_NUMA}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is enabled.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM*hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhM,hj hhubj6)}(h``min_slab_pages`` Minimal number of SLAB pages that cannot be reclaimed. Determined by ``vm.min_slab_ratio sysctl``. Only defined when ``CONFIG_NUMA`` is enabled h](j<)}(h``min_slab_pages``h]j)}(hj%h]hmin_slab_pages}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#ubah}(h]h ]h"]h$]h&]uh1j;hhhM0hjubjU)}(hhh]h)}(hMinimal number of SLAB pages that cannot be reclaimed. Determined by ``vm.min_slab_ratio sysctl``. Only defined when ``CONFIG_NUMA`` is enabledh](hEMinimal number of SLAB pages that cannot be reclaimed. Determined by }(hj=hhhNhNubj)}(h``vm.min_slab_ratio sysctl``h]hvm.min_slab_ratio sysctl}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj=ubh. Only defined when }(hj=hhhNhNubj)}(h``CONFIG_NUMA``h]h CONFIG_NUMA}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj=ubh is enabled}(hj=hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM/hj:ubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhM0hj hhubj6)}(h.``flags`` Flags controlling reclaim behavior. h](j<)}(h ``flags``h]j)}(hjh]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhM3hj{ubjU)}(hhh]h)}(h#Flags controlling reclaim behavior.h]h#Flags controlling reclaim behavior.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM3hjubah}(h]h ]h"]h$]h&]uh1jThj{ubeh}(h]h ]h"]h$]h&]uh1j5hhhM3hj hhubeh}(h]h ]h"]h$]h&]uh1j0hj hhhhhNubeh}(h]reclaim-controlah ]h"]reclaim controlah$]h&]uh1hhj_hhhhhMubh)}(hhh](h)}(hCompaction controlh]hCompaction control}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM6ubj1)}(hhh](j6)}(hI``kcompactd_max_order`` Page order that kcompactd should try to achieve. h](j<)}(h``kcompactd_max_order``h]j)}(hjh]hkcompactd_max_order}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhM9hjubjU)}(hhh]h)}(h0Page order that kcompactd should try to achieve.h]h0Page order that kcompactd should try to achieve.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM9hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhM9hjubj6)}(hS``kcompactd_highest_zoneidx`` The highest zone index to be compacted by kcompactd. h](j<)}(h``kcompactd_highest_zoneidx``h]j)}(hjh]hkcompactd_highest_zoneidx}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhM<hj ubjU)}(hhh]h)}(h4The highest zone index to be compacted by kcompactd.h]h4The highest zone index to be compacted by kcompactd.}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM<hj(ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1j5hhhM<hjhhubj6)}(hJ``kcompactd_wait`` Workqueue used to synchronize memory compaction tasks. h](j<)}(h``kcompactd_wait``h]j)}(hjKh]hkcompactd_wait}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjIubah}(h]h ]h"]h$]h&]uh1j;hhhM?hjEubjU)}(hhh]h)}(h6Workqueue used to synchronize memory compaction tasks.h]h6Workqueue used to synchronize memory compaction tasks.}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM?hj`ubah}(h]h ]h"]h$]h&]uh1jThjEubeh}(h]h ]h"]h$]h&]uh1j5hhhM?hjhhubj6)}(h<``kcompactd`` Per-node instance of kcompactd kernel thread. h](j<)}(h ``kcompactd``h]j)}(hjh]h kcompactd}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMBhj}ubjU)}(hhh]h)}(h-Per-node instance of kcompactd kernel thread.h]h-Per-node instance of kcompactd kernel thread.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMBhjubah}(h]h ]h"]h$]h&]uh1jThj}ubeh}(h]h ]h"]h$]h&]uh1j5hhhMBhjhhubj6)}(h``proactive_compact_trigger`` Determines if proactive compaction is enabled. Controlled by ``vm.compaction_proactiveness`` sysctl. h](j<)}(h``proactive_compact_trigger``h]j)}(hjh]hproactive_compact_trigger}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMFhjubjU)}(hhh]h)}(hdDetermines if proactive compaction is enabled. Controlled by ``vm.compaction_proactiveness`` sysctl.h](h=Determines if proactive compaction is enabled. Controlled by }(hjhhhNhNubj)}(h``vm.compaction_proactiveness``h]hvm.compaction_proactiveness}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh sysctl.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMEhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMFhjhhubeh}(h]h ]h"]h$]h&]uh1j0hjhhhhhNubeh}(h]compaction-controlah ]h"]h$]compaction controlah&]uh1hhj_hhhhhM6jKubh)}(hhh](h)}(h Statisticsh]h Statistics}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMIubj1)}(hhh](j6)}(h9``per_cpu_nodestats`` Per-CPU VM statistics for the node h](j<)}(h``per_cpu_nodestats``h]j)}(hj'h]hper_cpu_nodestats}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj%ubah}(h]h ]h"]h$]h&]uh1j;hhhMLhj!ubjU)}(hhh]h)}(h"Per-CPU VM statistics for the nodeh]h"Per-CPU VM statistics for the node}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMLhj<ubah}(h]h ]h"]h$]h&]uh1jThj!ubeh}(h]h ]h"]h$]h&]uh1j5hhhMLhjubj6)}(h(``vm_stat`` VM statistics for the node. h](j<)}(h ``vm_stat``h]j)}(hj_h]hvm_stat}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1jhj]ubah}(h]h ]h"]h$]h&]uh1j;hhhMOhjYubjU)}(hhh]h)}(hVM statistics for the node.h]hVM statistics for the node.}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMOhjtubah}(h]h ]h"]h$]h&]uh1jThjYubeh}(h]h ]h"]h$]h&]uh1j5hhhMOhjhhubeh}(h]h ]h"]h$]h&]uh1j0hj hhhhhNubh)}(h .. _zones:h]h}(h]h ]h"]h$]h&]juzonesuh1hhMQhj hhhhubeh}(h] statisticsah ]h"]h$] statisticsah&]uh1hhj_hhhhhMIjKubeh}(h]node-structureah ]h"]node structureah$]h&]uh1hhjwhhhhhKubeh}(h](jvid1eh ]h"]nodesah$]nodesah&]uh1hhhhhhhhKjKexpect_referenced_by_name}jjksexpect_referenced_by_id}jvjksubh)}(hhh](h)}(hZonesh]hZones}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMTubh)}(hXAs we have mentioned, each zone in memory is described by a ``struct zone`` which is an element of the ``node_zones`` array of the node it belongs to. ``struct zone`` is the core data structure of the page allocator. A zone represents a range of physical memory and may have holes.h](h ``ZONE_NORMAL`` > ``ZONE_DMA32``.h](h+The page allocator uses the GFP flags, see }(hjhhhNhNubh)}(h:ref:`mm-api-gfp-flags`h]j)}(hjh]hmm-api-gfp-flags}(hj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainj*reftyperef refexplicitrefwarnjmm-api-gfp-flagsuh1hhhhMZhjubhX, specified by a memory allocation to determine the highest zone in a node from which the memory allocation can allocate memory. The page allocator first allocates memory from that zone, if the page allocator can’t allocate the requested amount of memory from the zone, it will allocate memory from the next lower zone in the node, the process continues up to and including the lowest zone. For example, if a node contains }(hjhhhNhNubj)}(h``ZONE_DMA32``h]h ZONE_DMA32}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(hjhhhNhNubj)}(h``ZONE_NORMAL``h]h ZONE_NORMAL}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h``ZONE_MOVABLE``h]h ZONE_MOVABLE}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh0 and the highest zone of a memory allocation is }(hjhhhNhNubj)}(h``ZONE_MOVABLE``h]h ZONE_MOVABLE}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhK, the order of the zones from which the page allocator allocates memory is }(hjhhhNhNubj)}(h``ZONE_MOVABLE``h]h ZONE_MOVABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh > }(hjhhhNhNubj)}(h``ZONE_NORMAL``h]h ZONE_NORMAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh > }(hjhhhNhNubj)}(h``ZONE_DMA32``h]h ZONE_DMA32}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMZhjhhubh)}(hXAt runtime, free pages in a zone are in the Per-CPU Pagesets (PCP) or free areas of the zone. The Per-CPU Pagesets are a vital mechanism in the kernel's memory management system. By handling most frequent allocations and frees locally on each CPU, the Per-CPU Pagesets improve performance and scalability, especially on systems with many cores. The page allocator in the kernel employs a two-step strategy for memory allocation, starting with the Per-CPU Pagesets before falling back to the buddy allocator. Pages are transferred between the Per-CPU Pagesets and the global free areas (managed by the buddy allocator) in batches. This minimizes the overhead of frequent interactions with the global buddy allocator.h]hXAt runtime, free pages in a zone are in the Per-CPU Pagesets (PCP) or free areas of the zone. The Per-CPU Pagesets are a vital mechanism in the kernel’s memory management system. By handling most frequent allocations and frees locally on each CPU, the Per-CPU Pagesets improve performance and scalability, especially on systems with many cores. The page allocator in the kernel employs a two-step strategy for memory allocation, starting with the Per-CPU Pagesets before falling back to the buddy allocator. Pages are transferred between the Per-CPU Pagesets and the global free areas (managed by the buddy allocator) in batches. This minimizes the overhead of frequent interactions with the global buddy allocator.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMehjhhubh)}(hGArchitecture specific code calls free_area_init() to initializes zones.h]hGArchitecture specific code calls free_area_init() to initializes zones.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMphjhhubh)}(hhh](h)}(hZone structureh]hZone structure}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMsubh)}(hThe zones structure ``struct zone`` is defined in ``include/linux/mmzone.h``. Here we briefly describe fields of this structure:h](hThe zones structure }(hjhhhNhNubj)}(h``struct zone``h]h struct zone}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is defined in }(hjhhhNhNubj)}(h``include/linux/mmzone.h``h]hinclude/linux/mmzone.h}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh4. Here we briefly describe fields of this structure:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMthjhhubh)}(hhh](h)}(hGeneralh]hGeneral}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj#hhhhhMxubj1)}(hhh](j6)}(hXI``_watermark`` The watermarks for this zone. When the amount of free pages in a zone is below the min watermark, boosting is ignored, an allocation may trigger direct reclaim and direct compaction, it is also used to throttle direct reclaim. When the amount of free pages in a zone is below the low watermark, kswapd is woken up. When the amount of free pages in a zone is above the high watermark, kswapd stops reclaiming (a zone is balanced) when the ``NUMA_BALANCING_MEMORY_TIERING`` bit of ``sysctl_numa_balancing_mode`` is not set. The promo watermark is used for memory tiering and NUMA balancing. When the amount of free pages in a zone is above the promo watermark, kswapd stops reclaiming when the ``NUMA_BALANCING_MEMORY_TIERING`` bit of ``sysctl_numa_balancing_mode`` is set. The watermarks are set by ``__setup_per_zone_wmarks()``. The min watermark is calculated according to ``vm.min_free_kbytes`` sysctl. The other three watermarks are set according to the distance between two watermarks. The distance itself is calculated taking ``vm.watermark_scale_factor`` sysctl into account. h](j<)}(h``_watermark``h]j)}(hj=h]h _watermark}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj;ubah}(h]h ]h"]h$]h&]uh1j;hhhMhj7ubjU)}(hhh]h)}(hX9The watermarks for this zone. When the amount of free pages in a zone is below the min watermark, boosting is ignored, an allocation may trigger direct reclaim and direct compaction, it is also used to throttle direct reclaim. When the amount of free pages in a zone is below the low watermark, kswapd is woken up. When the amount of free pages in a zone is above the high watermark, kswapd stops reclaiming (a zone is balanced) when the ``NUMA_BALANCING_MEMORY_TIERING`` bit of ``sysctl_numa_balancing_mode`` is not set. The promo watermark is used for memory tiering and NUMA balancing. When the amount of free pages in a zone is above the promo watermark, kswapd stops reclaiming when the ``NUMA_BALANCING_MEMORY_TIERING`` bit of ``sysctl_numa_balancing_mode`` is set. The watermarks are set by ``__setup_per_zone_wmarks()``. The min watermark is calculated according to ``vm.min_free_kbytes`` sysctl. The other three watermarks are set according to the distance between two watermarks. The distance itself is calculated taking ``vm.watermark_scale_factor`` sysctl into account.h](hXThe watermarks for this zone. When the amount of free pages in a zone is below the min watermark, boosting is ignored, an allocation may trigger direct reclaim and direct compaction, it is also used to throttle direct reclaim. When the amount of free pages in a zone is below the low watermark, kswapd is woken up. When the amount of free pages in a zone is above the high watermark, kswapd stops reclaiming (a zone is balanced) when the }(hjUhhhNhNubj)}(h!``NUMA_BALANCING_MEMORY_TIERING``h]hNUMA_BALANCING_MEMORY_TIERING}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjUubh bit of }(hjUhhhNhNubj)}(h``sysctl_numa_balancing_mode``h]hsysctl_numa_balancing_mode}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1jhjUubh is not set. The promo watermark is used for memory tiering and NUMA balancing. When the amount of free pages in a zone is above the promo watermark, kswapd stops reclaiming when the }(hjUhhhNhNubj)}(h!``NUMA_BALANCING_MEMORY_TIERING``h]hNUMA_BALANCING_MEMORY_TIERING}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjUubh bit of }(hjUhhhNhNubj)}(h``sysctl_numa_balancing_mode``h]hsysctl_numa_balancing_mode}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjUubh# is set. The watermarks are set by }(hjUhhhNhNubj)}(h``__setup_per_zone_wmarks()``h]h__setup_per_zone_wmarks()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjUubh/. The min watermark is calculated according to }(hjUhhhNhNubj)}(h``vm.min_free_kbytes``h]hvm.min_free_kbytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjUubh sysctl. The other three watermarks are set according to the distance between two watermarks. The distance itself is calculated taking }(hjUhhhNhNubj)}(h``vm.watermark_scale_factor``h]hvm.watermark_scale_factor}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjUubh sysctl into account.}(hjUhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM{hjRubah}(h]h ]h"]h$]h&]uh1jThj7ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4ubj6)}(h``watermark_boost`` The number of pages which are used to boost watermarks to increase reclaim pressure to reduce the likelihood of future fallbacks and wake kswapd now as the node may be balanced overall and kswapd will not wake naturally. h](j<)}(h``watermark_boost``h]j)}(hjh]hwatermark_boost}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hThe number of pages which are used to boost watermarks to increase reclaim pressure to reduce the likelihood of future fallbacks and wake kswapd now as the node may be balanced overall and kswapd will not wake naturally.h]hThe number of pages which are used to boost watermarks to increase reclaim pressure to reduce the likelihood of future fallbacks and wake kswapd now as the node may be balanced overall and kswapd will not wake naturally.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(he``nr_reserved_highatomic`` The number of pages which are reserved for high-order atomic allocations. h](j<)}(h``nr_reserved_highatomic``h]j)}(hj+h]hnr_reserved_highatomic}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj)ubah}(h]h ]h"]h$]h&]uh1j;hhhMhj%ubjU)}(hhh]h)}(hIThe number of pages which are reserved for high-order atomic allocations.h]hIThe number of pages which are reserved for high-order atomic allocations.}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj@ubah}(h]h ]h"]h$]h&]uh1jThj%ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(hR``nr_free_highatomic`` The number of free pages in reserved highatomic pageblocks h](j<)}(h``nr_free_highatomic``h]j)}(hjch]hnr_free_highatomic}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1jhjaubah}(h]h ]h"]h$]h&]uh1j;hhhMhj]ubjU)}(hhh]h)}(h:The number of free pages in reserved highatomic pageblocksh]h:The number of free pages in reserved highatomic pageblocks}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjxubah}(h]h ]h"]h$]h&]uh1jThj]ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(hX``lowmem_reserve`` The array of the amounts of the memory reserved in this zone for memory allocations. For example, if the highest zone a memory allocation can allocate memory from is ``ZONE_MOVABLE``, the amount of memory reserved in this zone for this allocation is ``lowmem_reserve[ZONE_MOVABLE]`` when attempting to allocate memory from this zone. This is a mechanism the page allocator uses to prevent allocations which could use ``highmem`` from using too much ``lowmem``. For some specialised workloads on ``highmem`` machines, it is dangerous for the kernel to allow process memory to be allocated from the ``lowmem`` zone. This is because that memory could then be pinned via the ``mlock()`` system call, or by unavailability of swapspace. ``vm.lowmem_reserve_ratio`` sysctl determines how aggressive the kernel is in defending these lower zones. This array is recalculated by ``setup_per_zone_lowmem_reserve()`` at runtime if ``vm.lowmem_reserve_ratio`` sysctl changes. h](j<)}(h``lowmem_reserve``h]j)}(hjh]hlowmem_reserve}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hXThe array of the amounts of the memory reserved in this zone for memory allocations. For example, if the highest zone a memory allocation can allocate memory from is ``ZONE_MOVABLE``, the amount of memory reserved in this zone for this allocation is ``lowmem_reserve[ZONE_MOVABLE]`` when attempting to allocate memory from this zone. This is a mechanism the page allocator uses to prevent allocations which could use ``highmem`` from using too much ``lowmem``. For some specialised workloads on ``highmem`` machines, it is dangerous for the kernel to allow process memory to be allocated from the ``lowmem`` zone. This is because that memory could then be pinned via the ``mlock()`` system call, or by unavailability of swapspace. ``vm.lowmem_reserve_ratio`` sysctl determines how aggressive the kernel is in defending these lower zones. This array is recalculated by ``setup_per_zone_lowmem_reserve()`` at runtime if ``vm.lowmem_reserve_ratio`` sysctl changes.h](hThe array of the amounts of the memory reserved in this zone for memory allocations. For example, if the highest zone a memory allocation can allocate memory from is }(hjhhhNhNubj)}(h``ZONE_MOVABLE``h]h ZONE_MOVABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhD, the amount of memory reserved in this zone for this allocation is }(hjhhhNhNubj)}(h ``lowmem_reserve[ZONE_MOVABLE]``h]hlowmem_reserve[ZONE_MOVABLE]}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh when attempting to allocate memory from this zone. This is a mechanism the page allocator uses to prevent allocations which could use }(hjhhhNhNubj)}(h ``highmem``h]hhighmem}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh from using too much }(hjhhhNhNubj)}(h ``lowmem``h]hlowmem}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh$. For some specialised workloads on }(hjhhhNhNubj)}(h ``highmem``h]hhighmem}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh[ machines, it is dangerous for the kernel to allow process memory to be allocated from the }(hjhhhNhNubj)}(h ``lowmem``h]hlowmem}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh@ zone. This is because that memory could then be pinned via the }(hjhhhNhNubj)}(h ``mlock()``h]hmlock()}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh1 system call, or by unavailability of swapspace. }(hjhhhNhNubj)}(h``vm.lowmem_reserve_ratio``h]hvm.lowmem_reserve_ratio}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhn sysctl determines how aggressive the kernel is in defending these lower zones. This array is recalculated by }(hjhhhNhNubj)}(h#``setup_per_zone_lowmem_reserve()``h]hsetup_per_zone_lowmem_reserve()}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh at runtime if }(hjhhhNhNubj)}(h``vm.lowmem_reserve_ratio``h]hvm.lowmem_reserve_ratio}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh sysctl changes.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(h``node`` The index of the node this zone belongs to. Available only when ``CONFIG_NUMA`` is enabled because there is only one zone in a UMA system. h](j<)}(h``node``h]j)}(hjh]hnode}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hThe index of the node this zone belongs to. Available only when ``CONFIG_NUMA`` is enabled because there is only one zone in a UMA system.h](h@The index of the node this zone belongs to. Available only when }(hjhhhNhNubj)}(h``CONFIG_NUMA``h]h CONFIG_NUMA}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh; is enabled because there is only one zone in a UMA system.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(hW``zone_pgdat`` Pointer to the ``struct pglist_data`` of the node this zone belongs to. h](j<)}(h``zone_pgdat``h]j)}(hjh]h zone_pgdat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hGPointer to the ``struct pglist_data`` of the node this zone belongs to.h](hPointer to the }(hjhhhNhNubj)}(h``struct pglist_data``h]hstruct pglist_data}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh" of the node this zone belongs to.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(h``per_cpu_pageset`` Pointer to the Per-CPU Pagesets (PCP) allocated and initialized by ``setup_zone_pageset()``. By handling most frequent allocations and frees locally on each CPU, PCP improves performance and scalability on systems with many cores. h](j<)}(h``per_cpu_pageset``h]j)}(hjh]hper_cpu_pageset}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hPointer to the Per-CPU Pagesets (PCP) allocated and initialized by ``setup_zone_pageset()``. By handling most frequent allocations and frees locally on each CPU, PCP improves performance and scalability on systems with many cores.h](hCPointer to the Per-CPU Pagesets (PCP) allocated and initialized by }(hj3hhhNhNubj)}(h``setup_zone_pageset()``h]hsetup_zone_pageset()}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj3ubh. By handling most frequent allocations and frees locally on each CPU, PCP improves performance and scalability on systems with many cores.}(hj3hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj0ubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(h[``pageset_high_min`` Copied to the ``high_min`` of the Per-CPU Pagesets for faster access. h](j<)}(h``pageset_high_min``h]j)}(hjeh]hpageset_high_min}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1jhjcubah}(h]h ]h"]h$]h&]uh1j;hhhMhj_ubjU)}(hhh]h)}(hECopied to the ``high_min`` of the Per-CPU Pagesets for faster access.h](hCopied to the }(hj}hhhNhNubj)}(h ``high_min``h]hhigh_min}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj}ubh+ of the Per-CPU Pagesets for faster access.}(hj}hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjzubah}(h]h ]h"]h$]h&]uh1jThj_ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(h[``pageset_high_max`` Copied to the ``high_max`` of the Per-CPU Pagesets for faster access. h](j<)}(h``pageset_high_max``h]j)}(hjh]hpageset_high_max}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hECopied to the ``high_max`` of the Per-CPU Pagesets for faster access.h](hCopied to the }(hjhhhNhNubj)}(h ``high_max``h]hhigh_max}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh+ of the Per-CPU Pagesets for faster access.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(hX``pageset_batch`` Copied to the ``batch`` of the Per-CPU Pagesets for faster access. The ``batch``, ``high_min`` and ``high_max`` of the Per-CPU Pagesets are used to calculate the number of elements the Per-CPU Pagesets obtain from the buddy allocator under a single hold of the lock for efficiency. They are also used to decide if the Per-CPU Pagesets return pages to the buddy allocator in page free process. h](j<)}(h``pageset_batch``h]j)}(hjh]h pageset_batch}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hXCopied to the ``batch`` of the Per-CPU Pagesets for faster access. The ``batch``, ``high_min`` and ``high_max`` of the Per-CPU Pagesets are used to calculate the number of elements the Per-CPU Pagesets obtain from the buddy allocator under a single hold of the lock for efficiency. They are also used to decide if the Per-CPU Pagesets return pages to the buddy allocator in page free process.h](hCopied to the }(hjhhhNhNubj)}(h ``batch``h]hbatch}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh0 of the Per-CPU Pagesets for faster access. The }(hjhhhNhNubj)}(h ``batch``h]hbatch}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(hjhhhNhNubj)}(h ``high_min``h]hhigh_min}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h ``high_max``h]hhigh_max}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhX of the Per-CPU Pagesets are used to calculate the number of elements the Per-CPU Pagesets obtain from the buddy allocator under a single hold of the lock for efficiency. They are also used to decide if the Per-CPU Pagesets return pages to the buddy allocator in page free process.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(hXg``pageblock_flags`` The pointer to the flags for the pageblocks in the zone (see ``include/linux/pageblock-flags.h`` for flags list). The memory is allocated in ``setup_usemap()``. Each pageblock occupies ``NR_PAGEBLOCK_BITS`` bits. Defined only when ``CONFIG_FLATMEM`` is enabled. The flags is stored in ``mem_section`` when ``CONFIG_SPARSEMEM`` is enabled. h](j<)}(h``pageblock_flags``h]j)}(hjyh]hpageblock_flags}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubah}(h]h ]h"]h$]h&]uh1j;hhhMhjsubjU)}(hhh]h)}(hXRThe pointer to the flags for the pageblocks in the zone (see ``include/linux/pageblock-flags.h`` for flags list). The memory is allocated in ``setup_usemap()``. Each pageblock occupies ``NR_PAGEBLOCK_BITS`` bits. Defined only when ``CONFIG_FLATMEM`` is enabled. The flags is stored in ``mem_section`` when ``CONFIG_SPARSEMEM`` is enabled.h](h=The pointer to the flags for the pageblocks in the zone (see }(hjhhhNhNubj)}(h#``include/linux/pageblock-flags.h``h]hinclude/linux/pageblock-flags.h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh- for flags list). The memory is allocated in }(hjhhhNhNubj)}(h``setup_usemap()``h]hsetup_usemap()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh. Each pageblock occupies }(hjhhhNhNubj)}(h``NR_PAGEBLOCK_BITS``h]hNR_PAGEBLOCK_BITS}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh bits. Defined only when }(hjhhhNhNubj)}(h``CONFIG_FLATMEM``h]hCONFIG_FLATMEM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh$ is enabled. The flags is stored in }(hjhhhNhNubj)}(h``mem_section``h]h mem_section}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh when }(hjhhhNhNubj)}(h``CONFIG_SPARSEMEM``h]hCONFIG_SPARSEMEM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is enabled.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjsubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(hd``zone_start_pfn`` The start pfn of the zone. It is initialized by ``calculate_node_totalpages()``. h](j<)}(h``zone_start_pfn``h]j)}(hjh]hzone_start_pfn}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hPThe start pfn of the zone. It is initialized by ``calculate_node_totalpages()``.h](h0The start pfn of the zone. It is initialized by }(hj5hhhNhNubj)}(h``calculate_node_totalpages()``h]hcalculate_node_totalpages()}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj5ubh.}(hj5hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj2ubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(hX``managed_pages`` The present pages managed by the buddy system, which is calculated as: ``managed_pages`` = ``present_pages`` - ``reserved_pages``, ``reserved_pages`` includes pages allocated by the memblock allocator. It should be used by page allocator and vm scanner to calculate all kinds of watermarks and thresholds. It is accessed using ``atomic_long_xxx()`` functions. It is initialized in ``free_area_init_core()`` and then is reinitialized when memblock allocator frees pages into buddy system. h](j<)}(h``managed_pages``h]j)}(hjgh]h managed_pages}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1jhjeubah}(h]h ]h"]h$]h&]uh1j;hhhMhjaubjU)}(hhh]h)}(hXThe present pages managed by the buddy system, which is calculated as: ``managed_pages`` = ``present_pages`` - ``reserved_pages``, ``reserved_pages`` includes pages allocated by the memblock allocator. It should be used by page allocator and vm scanner to calculate all kinds of watermarks and thresholds. It is accessed using ``atomic_long_xxx()`` functions. It is initialized in ``free_area_init_core()`` and then is reinitialized when memblock allocator frees pages into buddy system.h](hGThe present pages managed by the buddy system, which is calculated as: }(hjhhhNhNubj)}(h``managed_pages``h]h managed_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh = }(hjhhhNhNubj)}(h``present_pages``h]h present_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh - }(hjhhhNhNubj)}(h``reserved_pages``h]hreserved_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(hjhhhNhNubj)}(h``reserved_pages``h]hreserved_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh includes pages allocated by the memblock allocator. It should be used by page allocator and vm scanner to calculate all kinds of watermarks and thresholds. It is accessed using }(hjhhhNhNubj)}(h``atomic_long_xxx()``h]hatomic_long_xxx()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh! functions. It is initialized in }(hjhhhNhNubj)}(h``free_area_init_core()``h]hfree_area_init_core()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhQ and then is reinitialized when memblock allocator frees pages into buddy system.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj|ubah}(h]h ]h"]h$]h&]uh1jThjaubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(h``spanned_pages`` The total pages spanned by the zone, including holes, which is calculated as: ``spanned_pages`` = ``zone_end_pfn`` - ``zone_start_pfn``. It is initialized by ``calculate_node_totalpages()``. h](j<)}(h``spanned_pages``h]j)}(hj h]h spanned_pages}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hThe total pages spanned by the zone, including holes, which is calculated as: ``spanned_pages`` = ``zone_end_pfn`` - ``zone_start_pfn``. It is initialized by ``calculate_node_totalpages()``.h](hNThe total pages spanned by the zone, including holes, which is calculated as: }(hj#hhhNhNubj)}(h``spanned_pages``h]h spanned_pages}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#ubh = }(hj#hhhNhNubj)}(h``zone_end_pfn``h]h zone_end_pfn}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#ubh - }(hj#hhhNhNubj)}(h``zone_start_pfn``h]hzone_start_pfn}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#ubh. It is initialized by }(hj#hhhNhNubj)}(h``calculate_node_totalpages()``h]hcalculate_node_totalpages()}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#ubh.}(hj#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(hX@``present_pages`` The physical pages existing within the zone, which is calculated as: ``present_pages`` = ``spanned_pages`` - ``absent_pages`` (pages in holes). It may be used by memory hotplug or memory power management logic to figure out unmanaged pages by checking (``present_pages`` - ``managed_pages``). Write access to ``present_pages`` at runtime should be protected by ``mem_hotplug_begin/done()``. Any reader who can't tolerant drift of ``present_pages`` should use ``get_online_mems()`` to get a stable value. It is initialized by ``calculate_node_totalpages()``. h](j<)}(h``present_pages``h]j)}(hjh]h present_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hX-The physical pages existing within the zone, which is calculated as: ``present_pages`` = ``spanned_pages`` - ``absent_pages`` (pages in holes). It may be used by memory hotplug or memory power management logic to figure out unmanaged pages by checking (``present_pages`` - ``managed_pages``). Write access to ``present_pages`` at runtime should be protected by ``mem_hotplug_begin/done()``. Any reader who can't tolerant drift of ``present_pages`` should use ``get_online_mems()`` to get a stable value. It is initialized by ``calculate_node_totalpages()``.h](hEThe physical pages existing within the zone, which is calculated as: }(hjhhhNhNubj)}(h``present_pages``h]h present_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh = }(hjhhhNhNubj)}(h``spanned_pages``h]h spanned_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh - }(hjhhhNhNubj)}(h``absent_pages``h]h absent_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh (pages in holes). It may be used by memory hotplug or memory power management logic to figure out unmanaged pages by checking (}(hjhhhNhNubj)}(h``present_pages``h]h present_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh - }hjsbj)}(h``managed_pages``h]h managed_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh). Write access to }(hjhhhNhNubj)}(h``present_pages``h]h present_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh# at runtime should be protected by }(hjhhhNhNubj)}(h``mem_hotplug_begin/done()``h]hmem_hotplug_begin/done()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh+. Any reader who can’t tolerant drift of }(hjhhhNhNubj)}(h``present_pages``h]h present_pages}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh should use }(hjhhhNhNubj)}(h``get_online_mems()``h]hget_online_mems()}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh- to get a stable value. It is initialized by }(hjhhhNhNubj)}(h``calculate_node_totalpages()``h]hcalculate_node_totalpages()}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(h``present_early_pages`` The present pages existing within the zone located on memory available since early boot, excluding hotplugged memory. Defined only when ``CONFIG_MEMORY_HOTPLUG`` is enabled and initialized by ``calculate_node_totalpages()``. h](j<)}(h``present_early_pages``h]j)}(hjwh]hpresent_early_pages}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjuubah}(h]h ]h"]h$]h&]uh1j;hhhMhjqubjU)}(hhh]h)}(hThe present pages existing within the zone located on memory available since early boot, excluding hotplugged memory. Defined only when ``CONFIG_MEMORY_HOTPLUG`` is enabled and initialized by ``calculate_node_totalpages()``.h](hThe present pages existing within the zone located on memory available since early boot, excluding hotplugged memory. Defined only when }(hjhhhNhNubj)}(h``CONFIG_MEMORY_HOTPLUG``h]hCONFIG_MEMORY_HOTPLUG}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is enabled and initialized by }(hjhhhNhNubj)}(h``calculate_node_totalpages()``h]hcalculate_node_totalpages()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjqubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(h``cma_pages`` The pages reserved for CMA use. These pages behave like ``ZONE_MOVABLE`` when they are not used for CMA. Defined only when ``CONFIG_CMA`` is enabled. h](j<)}(h ``cma_pages``h]j)}(hjh]h cma_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hThe pages reserved for CMA use. These pages behave like ``ZONE_MOVABLE`` when they are not used for CMA. Defined only when ``CONFIG_CMA`` is enabled.h](h8The pages reserved for CMA use. These pages behave like }(hjhhhNhNubj)}(h``ZONE_MOVABLE``h]h ZONE_MOVABLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh3 when they are not used for CMA. Defined only when }(hjhhhNhNubj)}(h``CONFIG_CMA``h]h CONFIG_CMA}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is enabled.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(hi``name`` The name of the zone. It is a pointer to the corresponding element of the ``zone_names`` array. h](j<)}(h``name``h]j)}(hj/h]hname}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj-ubah}(h]h ]h"]h$]h&]uh1j;hhhMhj)ubjU)}(hhh]h)}(h_The name of the zone. It is a pointer to the corresponding element of the ``zone_names`` array.h](hJThe name of the zone. It is a pointer to the corresponding element of the }(hjGhhhNhNubj)}(h``zone_names``h]h zone_names}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjGubh array.}(hjGhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjDubah}(h]h ]h"]h$]h&]uh1jThj)ubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(h``nr_isolate_pageblock`` Number of isolated pageblocks. It is used to solve incorrect freepage counting problem due to racy retrieving migratetype of pageblock. Protected by ``zone->lock``. Defined only when ``CONFIG_MEMORY_ISOLATION`` is enabled. h](j<)}(h``nr_isolate_pageblock``h]j)}(hjyh]hnr_isolate_pageblock}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubah}(h]h ]h"]h$]h&]uh1j;hhhMhjsubjU)}(hhh]h)}(hNumber of isolated pageblocks. It is used to solve incorrect freepage counting problem due to racy retrieving migratetype of pageblock. Protected by ``zone->lock``. Defined only when ``CONFIG_MEMORY_ISOLATION`` is enabled.h](hNumber of isolated pageblocks. It is used to solve incorrect freepage counting problem due to racy retrieving migratetype of pageblock. Protected by }(hjhhhNhNubj)}(h``zone->lock``h]h zone->lock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh. Defined only when }(hjhhhNhNubj)}(h``CONFIG_MEMORY_ISOLATION``h]hCONFIG_MEMORY_ISOLATION}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is enabled.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjsubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(hX.``span_seqlock`` The seqlock to protect ``zone_start_pfn`` and ``spanned_pages``. It is a seqlock because it has to be read outside of ``zone->lock``, and it is done in the main allocator path. However, the seqlock is written quite infrequently. Defined only when ``CONFIG_MEMORY_HOTPLUG`` is enabled. h](j<)}(h``span_seqlock``h]j)}(hjh]h span_seqlock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjubjU)}(hhh]h)}(hXThe seqlock to protect ``zone_start_pfn`` and ``spanned_pages``. It is a seqlock because it has to be read outside of ``zone->lock``, and it is done in the main allocator path. However, the seqlock is written quite infrequently. Defined only when ``CONFIG_MEMORY_HOTPLUG`` is enabled.h](hThe seqlock to protect }(hjhhhNhNubj)}(h``zone_start_pfn``h]hzone_start_pfn}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h``spanned_pages``h]h spanned_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh7. It is a seqlock because it has to be read outside of }(hjhhhNhNubj)}(h``zone->lock``h]h zone->lock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhs, and it is done in the main allocator path. However, the seqlock is written quite infrequently. Defined only when }(hjhhhNhNubj)}(h``CONFIG_MEMORY_HOTPLUG``h]hCONFIG_MEMORY_HOTPLUG}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is enabled.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(ht``initialized`` The flag indicating if the zone is initialized. Set by ``init_currently_empty_zone()`` during boot. h](j<)}(h``initialized``h]j)}(hjUh]h initialized}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjSubah}(h]h ]h"]h$]h&]uh1j;hhhMhjOubjU)}(hhh]h)}(hcThe flag indicating if the zone is initialized. Set by ``init_currently_empty_zone()`` during boot.h](h7The flag indicating if the zone is initialized. Set by }(hjmhhhNhNubj)}(h``init_currently_empty_zone()``h]hinit_currently_empty_zone()}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjmubh during boot.}(hjmhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjjubah}(h]h ]h"]h$]h&]uh1jThjOubeh}(h]h ]h"]h$]h&]uh1j5hhhMhj4hhubj6)}(hX ``free_area`` The array of free areas, where each element corresponds to a specific order which is a power of two. The buddy allocator uses this structure to manage free memory efficiently. When allocating, it tries to find the smallest sufficient block, if the smallest sufficient block is larger than the requested size, it will be recursively split into the next smaller blocks until the required size is reached. When a page is freed, it may be merged with its buddy to form a larger block. It is initialized by ``zone_init_free_lists()``. h](j<)}(h ``free_area``h]j)}(hjh]h free_area}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhM hjubjU)}(hhh]h)}(hXThe array of free areas, where each element corresponds to a specific order which is a power of two. The buddy allocator uses this structure to manage free memory efficiently. When allocating, it tries to find the smallest sufficient block, if the smallest sufficient block is larger than the requested size, it will be recursively split into the next smaller blocks until the required size is reached. When a page is freed, it may be merged with its buddy to form a larger block. It is initialized by ``zone_init_free_lists()``.h](hXThe array of free areas, where each element corresponds to a specific order which is a power of two. The buddy allocator uses this structure to manage free memory efficiently. When allocating, it tries to find the smallest sufficient block, if the smallest sufficient block is larger than the requested size, it will be recursively split into the next smaller blocks until the required size is reached. When a page is freed, it may be merged with its buddy to form a larger block. It is initialized by }(hjhhhNhNubj)}(h``zone_init_free_lists()``h]hzone_init_free_lists()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1j5hhhM hj4hhubj6)}(h``unaccepted_pages`` The list of pages to be accepted. All pages on the list are ``MAX_PAGE_ORDER``. Defined only when ``CONFIG_UNACCEPTED_MEMORY`` is enabled. h](j<)}(h``unaccepted_pages``h]j)}(hjh]hunaccepted_pages}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j;hhhM hjubjU)}(hhh]h)}(hThe list of pages to be accepted. All pages on the list are ``MAX_PAGE_ORDER``. Defined only when ``CONFIG_UNACCEPTED_MEMORY`` is enabled.h](h