Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) .. _admin_guide_memory_hotplug:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) ==============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) Memory Hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) ==============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) :Created:							Jul 28 2007
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) :Updated: Add some details about locking internals:		Aug 20 2018
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) This document is about memory hotplug including how-to-use and current status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) Because Memory Hotplug is still under development, contents of this text will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) be changed often.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) .. contents:: :local:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)     (1) x86_64's has special implementation for memory hotplug.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)         This text does not describe it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)     (2) This text assumes that sysfs is mounted at ``/sys``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) Introduction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) Purpose of memory hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) -------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) Memory Hotplug allows users to increase/decrease the amount of memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) Generally, there are two purposes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) (A) For changing the amount of memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)     This is to allow a feature like capacity on demand.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) (B) For installing/removing DIMMs or NUMA-nodes physically.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)     This is to exchange DIMMs/NUMA-nodes, reduce power consumption, etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) (A) is required by highly virtualized environments and (B) is required by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) hardware which supports memory power management.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) Linux memory hotplug is designed for both purpose.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) Phases of memory hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) There are 2 phases in Memory Hotplug:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)   1) Physical Memory Hotplug phase
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)   2) Logical Memory Hotplug phase.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) The First phase is to communicate hardware/firmware and make/erase
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) environment for hotplugged memory. Basically, this phase is necessary
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) for the purpose (B), but this is good phase for communication between
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) highly virtualized environments too.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) When memory is hotplugged, the kernel recognizes new memory, makes new memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) management tables, and makes sysfs files for new memory's operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) If firmware supports notification of connection of new memory to OS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) this phase is triggered automatically. ACPI can notify this event. If not,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) "probe" operation by system administration is used instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) (see :ref:`memory_hotplug_physical_mem`).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) Logical Memory Hotplug phase is to change memory state into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) available/unavailable for users. Amount of memory from user's view is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) changed by this phase. The kernel makes all memory in it as free pages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) when a memory range is available.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) In this document, this phase is described as online/offline.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) Logical Memory Hotplug phase is triggered by write of sysfs file by system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) administrator. For the hot-add case, it must be executed after Physical Hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) phase by hand.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) (However, if you writes udev's hotplug scripts for memory hotplug, these
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) phases can be execute in seamless way.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) Unit of Memory online/offline operation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) ---------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) Memory hotplug uses SPARSEMEM memory model which allows memory to be divided
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) into chunks of the same size. These chunks are called "sections". The size of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) a memory section is architecture dependent. For example, power uses 16MiB, ia64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) uses 1GiB.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) Memory sections are combined into chunks referred to as "memory blocks". The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) size of a memory block is architecture dependent and represents the logical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) unit upon which memory online/offline operations are to be performed. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) default size of a memory block is the same as memory section size unless an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) architecture specifies otherwise. (see :ref:`memory_hotplug_sysfs_files`.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) To determine the size (in bytes) of a memory block please read this file::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)   /sys/devices/system/memory/block_size_bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) Kernel Configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) ====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) To use memory hotplug feature, kernel must be compiled with following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) config options.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) - For all memory hotplug:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)     - Memory model -> Sparse Memory  (``CONFIG_SPARSEMEM``)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)     - Allow for memory hot-add       (``CONFIG_MEMORY_HOTPLUG``)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) - To enable memory removal, the following are also necessary:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)     - Allow for memory hot remove    (``CONFIG_MEMORY_HOTREMOVE``)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)     - Page Migration                 (``CONFIG_MIGRATION``)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) - For ACPI memory hotplug, the following are also necessary:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)     - Memory hotplug (under ACPI Support menu) (``CONFIG_ACPI_HOTPLUG_MEMORY``)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)     - This option can be kernel module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) - As a related configuration, if your box has a feature of NUMA-node hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)   via ACPI, then this option is necessary too.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)     - ACPI0004,PNP0A05 and PNP0A06 Container Driver (under ACPI Support menu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)       (``CONFIG_ACPI_CONTAINER``).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)      This option can be kernel module too.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) .. _memory_hotplug_sysfs_files:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) sysfs files for memory hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) ==============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) All memory blocks have their device information in sysfs.  Each memory block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) is described under ``/sys/devices/system/memory`` as::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	/sys/devices/system/memory/memoryXXX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) where XXX is the memory block id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) For the memory block covered by the sysfs directory.  It is expected that all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) memory sections in this range are present and no memory holes exist in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) range. Currently there is no way to determine if there is a memory hole, but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) the existence of one should not affect the hotplug capabilities of the memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) block.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) For example, assume 1GiB memory block size. A device for a memory starting at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 0x100000000 is ``/sys/device/system/memory/memory4``::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	(0x100000000 / 1Gib = 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) This device covers address range [0x100000000 ... 0x140000000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) Under each memory block, you can see 5 files:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) - ``/sys/devices/system/memory/memoryXXX/phys_index``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) - ``/sys/devices/system/memory/memoryXXX/phys_device``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) - ``/sys/devices/system/memory/memoryXXX/state``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) - ``/sys/devices/system/memory/memoryXXX/removable``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) - ``/sys/devices/system/memory/memoryXXX/valid_zones``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) =================== ============================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) ``phys_index``      read-only and contains memory block id, same as XXX.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) ``state``           read-write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)                     - at read:  contains online/offline state of memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)                     - at write: user can specify "online_kernel",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)                     "online_movable", "online", "offline" command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)                     which will be performed on all sections in the block.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) ``phys_device``	    read-only: legacy interface only ever used on s390x to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		    expose the covered storage increment.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) ``removable``       read-only: contains an integer value indicating
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)                     whether the memory block is removable or not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)                     removable.  A value of 1 indicates that the memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)                     block is removable and a value of 0 indicates that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)                     it is not removable. A memory block is removable only if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)                     every section in the block is removable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) ``valid_zones``     read-only: designed to show which zones this memory block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 		    can be onlined to.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		    The first column shows it`s default zone.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		    "memory6/valid_zones: Normal Movable" shows this memoryblock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		    can be onlined to ZONE_NORMAL by default and to ZONE_MOVABLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 		    by online_movable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		    "memory7/valid_zones: Movable Normal" shows this memoryblock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		    can be onlined to ZONE_MOVABLE by default and to ZONE_NORMAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		    by online_kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) =================== ============================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)   These directories/files appear after physical memory hotplug phase.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) If CONFIG_NUMA is enabled the memoryXXX/ directories can also be accessed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) via symbolic links located in the ``/sys/devices/system/node/node*`` directories.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) For example::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	/sys/devices/system/node/node0/memory9 -> ../../memory/memory9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) A backlink will also be created::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	/sys/devices/system/memory/memory9/node0 -> ../../node/node0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) .. _memory_hotplug_physical_mem:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) Physical memory hot-add phase
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) Hardware(Firmware) Support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) --------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) On x86_64/ia64 platform, memory hotplug by ACPI is supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) In general, the firmware (ACPI) which supports memory hotplug defines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) memory class object of _HID "PNP0C80". When a notify is asserted to PNP0C80,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) Linux's ACPI handler does hot-add memory to the system and calls a hotplug udev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) script. This will be done automatically.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) But scripts for memory hotplug are not contained in generic udev package(now).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) You may have to write it by yourself or online/offline memory by hand.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) Please see :ref:`memory_hotplug_how_to_online_memory` and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) :ref:`memory_hotplug_how_to_offline_memory`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) If firmware supports NUMA-node hotplug, and defines an object _HID "ACPI0004",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) "PNP0A05", or "PNP0A06", notification is asserted to it, and ACPI handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) calls hotplug code for all of objects which are defined in it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) If memory device is found, memory hotplug code will be called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) Notify memory hot-add event by hand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) -----------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) On some architectures, the firmware may not notify the kernel of a memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) hotplug event.  Therefore, the memory "probe" interface is supported to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) explicitly notify the kernel.  This interface depends on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) CONFIG_ARCH_MEMORY_PROBE and can be configured on powerpc, sh, and x86
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) if hotplug is supported, although for x86 this should be handled by ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) notification.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) Probe interface is located at::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	/sys/devices/system/memory/probe
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) You can tell the physical address of new memory to the kernel by::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	% echo start_address_of_new_memory > /sys/devices/system/memory/probe
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) Then, [start_address_of_new_memory, start_address_of_new_memory +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) memory_block_size] memory range is hot-added. In this case, hotplug script is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) not called (in current implementation). You'll have to online memory by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) yourself.  Please see :ref:`memory_hotplug_how_to_online_memory`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) Logical Memory hot-add phase
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) ============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) State of memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) ---------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) To see (online/offline) state of a memory block, read 'state' file::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	% cat /sys/device/system/memory/memoryXXX/state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) - If the memory block is online, you'll read "online".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) - If the memory block is offline, you'll read "offline".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) .. _memory_hotplug_how_to_online_memory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) How to online memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) --------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) When the memory is hot-added, the kernel decides whether or not to "online"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) it according to the policy which can be read from "auto_online_blocks" file::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	% cat /sys/devices/system/memory/auto_online_blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) The default depends on the CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE kernel config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) option. If it is disabled the default is "offline" which means the newly added
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) memory is not in a ready-to-use state and you have to "online" the newly added
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) memory blocks manually. Automatic onlining can be requested by writing "online"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) to "auto_online_blocks" file::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	% echo online > /sys/devices/system/memory/auto_online_blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) This sets a global policy and impacts all memory blocks that will subsequently
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) be hotplugged. Currently offline blocks keep their state. It is possible, under
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) certain circumstances, that some memory blocks will be added but will fail to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) online. User space tools can check their "state" files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) (``/sys/devices/system/memory/memoryXXX/state``) and try to online them manually.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) If the automatic onlining wasn't requested, failed, or some memory block was
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) offlined it is possible to change the individual block's state by writing to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) "state" file::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	% echo online > /sys/devices/system/memory/memoryXXX/state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) This onlining will not change the ZONE type of the target memory block,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) If the memory block doesn't belong to any zone an appropriate kernel zone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) (usually ZONE_NORMAL) will be used unless movable_node kernel command line
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) option is specified when ZONE_MOVABLE will be used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) You can explicitly request to associate it with ZONE_MOVABLE by::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	% echo online_movable > /sys/devices/system/memory/memoryXXX/state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) .. note:: current limit: this memory block must be adjacent to ZONE_MOVABLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) Or you can explicitly request a kernel zone (usually ZONE_NORMAL) by::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	% echo online_kernel > /sys/devices/system/memory/memoryXXX/state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) .. note:: current limit: this memory block must be adjacent to ZONE_NORMAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) An explicit zone onlining can fail (e.g. when the range is already within
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) and existing and incompatible zone already).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) After this, memory block XXX's state will be 'online' and the amount of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) available memory will be increased.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) This may be changed in future.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) Logical memory remove
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) =====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) Memory offline and ZONE_MOVABLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) -------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) Memory offlining is more complicated than memory online. Because memory offline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) has to make the whole memory block be unused, memory offline can fail if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) the memory block includes memory which cannot be freed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) In general, memory offline can use 2 techniques.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) (1) reclaim and free all memory in the memory block.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) (2) migrate all pages in the memory block.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) In the current implementation, Linux's memory offline uses method (2), freeing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) all  pages in the memory block by page migration. But not all pages are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) migratable. Under current Linux, migratable pages are anonymous pages and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) page caches. For offlining a memory block by migration, the kernel has to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) guarantee that the memory block contains only migratable pages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) Now, a boot option for making a memory block which consists of migratable pages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) is supported. By specifying "kernelcore=" or "movablecore=" boot option, you can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) create ZONE_MOVABLE...a zone which is just used for movable pages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) (See also Documentation/admin-guide/kernel-parameters.rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) Assume the system has "TOTAL" amount of memory at boot time, this boot option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) creates ZONE_MOVABLE as following.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 1) When kernelcore=YYYY boot option is used,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)    Size of memory not for movable pages (not for offline) is YYYY.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)    Size of memory for movable pages (for offline) is TOTAL-YYYY.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 2) When movablecore=ZZZZ boot option is used,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)    Size of memory not for movable pages (not for offline) is TOTAL - ZZZZ.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)    Size of memory for movable pages (for offline) is ZZZZ.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)    Unfortunately, there is no information to show which memory block belongs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)    to ZONE_MOVABLE. This is TBD.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) .. _memory_hotplug_how_to_offline_memory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) How to offline memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) ---------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) You can offline a memory block by using the same sysfs interface that was used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) in memory onlining::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	% echo offline > /sys/devices/system/memory/memoryXXX/state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) If offline succeeds, the state of the memory block is changed to be "offline".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) If it fails, some error core (like -EBUSY) will be returned by the kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) Even if a memory block does not belong to ZONE_MOVABLE, you can try to offline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) it.  If it doesn't contain 'unmovable' memory, you'll get success.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) A memory block under ZONE_MOVABLE is considered to be able to be offlined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) easily.  But under some busy state, it may return -EBUSY. Even if a memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) block cannot be offlined due to -EBUSY, you can retry offlining it and may be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) able to offline it (or not). (For example, a page is referred to by some kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) internal call and released soon.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) Consideration:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)   Memory hotplug's design direction is to make the possibility of memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)   offlining higher and to guarantee unplugging memory under any situation. But
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)   it needs more work. Returning -EBUSY under some situation may be good because
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)   the user can decide to retry more or not by himself. Currently, memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)   offlining code does some amount of retry with 120 seconds timeout.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) Physical memory remove
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) ======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) Need more implementation yet....
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)  - Notification completion of remove works by OS to firmware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)  - Guard from remove if not yet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) Locking Internals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) When adding/removing memory that uses memory block devices (i.e. ordinary RAM),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) the device_hotplug_lock should be held to:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) - synchronize against online/offline requests (e.g. via sysfs). This way, memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)   block devices can only be accessed (.online/.state attributes) by user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)   space once memory has been fully added. And when removing memory, we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)   know nobody is in critical sections.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) - synchronize against CPU hotplug and similar (e.g. relevant for ACPI and PPC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) Especially, there is a possible lock inversion that is avoided using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) device_hotplug_lock when adding memory and user space tries to online that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) memory faster than expected:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) - device_online() will first take the device_lock(), followed by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)   mem_hotplug_lock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) - add_memory_resource() will first take the mem_hotplug_lock, followed by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415)   the device_lock() (while creating the devices, during bus_add_device()).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) As the device is visible to user space before taking the device_lock(), this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) can result in a lock inversion.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) onlining/offlining of memory should be done via device_online()/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) device_offline() - to make sure it is properly synchronized to actions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) via sysfs. Holding device_hotplug_lock is advised (to e.g. protect online_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) When adding/removing/onlining/offlining memory or adding/removing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) heterogeneous/device memory, we should always hold the mem_hotplug_lock in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) write mode to serialise memory hotplug (e.g. access to global/zone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) variables).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) In addition, mem_hotplug_lock (in contrast to device_hotplug_lock) in read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) mode allows for a quite efficient get_online_mems/put_online_mems
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) implementation, so code accessing memory can protect from that memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) vanishing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) Future Work
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)   - allowing memory hot-add to ZONE_MOVABLE. maybe we need some switch like
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)     sysctl or new control file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)   - showing memory block and physical device relationship.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)   - test and make it better memory offlining.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)   - support HugeTLB page migration and offlining.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)   - memmap removing at memory offline.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)   - physical remove memory.