요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
==============
Memory Hotplug
==============
The final phase of surfacing CXL memory to the kernel page allocator is for
the `DAX` driver to surface a `Driver Managed` memory region via the
memory-hotplug component.
There are four major configurations to consider:
1) Default Online Behavior (on/off and zone)
2) Hotplug Memory Block size
3) Memory Map Resource location
4) Driver-Managed Memory Designation
Default Online Behavior
=======================
The default-online behavior of hotplug memory is dictated by the following,
in order of precedence:
- :code:`CONFIG_MHP_DEFAULT_ONLINE_TYPE` Build Configuration
- :code:`memhp_default_state` Boot parameter
- :code:`/sys/devices/system/memory/auto_online_blocks` value
These dictate whether hotplugged memory blocks arrive in one of three states:
1) Offline
2) Online in :code:`ZONE_NORMAL`
3) Online in :code:`ZONE_MOVABLE`
:code:`ZONE_NORMAL` implies this capacity may be used for almost any allocation,
while :code:`ZONE_MOVABLE` implies this capacity should only be used for
migratable allocations.
:code:`ZONE_MOVABLE` attempts to retain the hotplug-ability of a memory block
so that it the entire region may be hot-unplugged at a later time. Any capacity
onlined into :code:`ZONE_NORMAL` should be considered permanently attached to
the page allocator.
Hotplug Memory Block Size
=========================
By default, on most architectures, the Hotplug Memory Block Size is either
128MB or 256MB. On x86, the block size increases up to 2GB as total memory
capacity exceeds 64GB. As of v6.15, Linux does not take into account the
size and alignment of the ACPI CEDT CFMWS regions (see Early Boot docs) when
deciding the Hotplug Memory Block Size.
Memory Map
==========
The location of :code:`struct folio` allocations to represent the hotplugged
memory capacity are dictated by the following system settings:
- :code:`/sys_module/memory_hotplug/parameters/memmap_on_memory`
- :code:`/sys/bus/dax/devices/daxN.Y/memmap_on_memory`
If both of these parameters are set to true, :code:`struct folio` for this
capacity will be carved out of the memory block being onlined. This has
performance implications if the memory is particularly high-latency and
its :code:`struct folio` becomes hotly contended.
If either parameter is set to false, :code:`struct folio` for this capacity
will be allocated from the local node of the processor running the hotplug
procedure. This capacity will be allocated from :code:`ZONE_NORMAL` on
that node, as it is a :code:`GFP_KERNEL` allocation.
Systems with extremely large amounts of :code:`ZONE_MOVABLE` memory (e.g.
CXL memory pools) must ensure that there is sufficient local
:code:`ZONE_NORMAL` capacity to host the memory map for the hotplugged capacity.
Driver Managed Memory
=====================
The DAX driver surfaces this memory to memory-hotplug as "Driver Managed". This
is not a configurable setting, but it's important to note that driver managed
memory is explicitly excluded from use during kexec. This is required to ensure
any reset or out-of-band operations that the CXL device may be subject to during
a functional system-reboot (such as a reset-on-probe) will not cause portions of
the kexec kernel to be overwritten.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
CXL memory hotplug의 네 구성 요소
1-16.. SPDX-License-Identifier: GPL-2.0
CXL memory를 kernel page allocator에 노출하는 마지막 단계에서는 `DAX` driver가 memory-hotplug component를 통해 `Driver Managed` memory region을 드러냅니다.
고려해야 할 주요 구성은 네 가지입니다.
- 기본 online 동작: on/off와 zone
- Hotplug Memory Block size
- Memory Map resource 위치
- Driver-Managed Memory 지정
기본 online 동작
17-40hotplug memory의 기본 online 동작은 우선순위가 높은 순서대로 다음 설정이 결정합니다.
- `CONFIG_MHP_DEFAULT_ONLINE_TYPE` build configuration
- `memhp_default_state` boot parameter
- `/sys/devices/system/memory/auto_online_blocks` 값
이 설정들은 hotplug된 memory block을 다음 세 상태 중 하나로 만듭니다.
- Offline
- `ZONE_NORMAL`에서 Online
- `ZONE_MOVABLE`에서 Online
`ZONE_NORMAL` capacity는 거의 모든 할당에 사용할 수 있습니다. 반면 `ZONE_MOVABLE` capacity는 이동할 수 있는 할당에만 사용해야 합니다.
`ZONE_MOVABLE`은 나중에 region 전체를 hot-unplug할 수 있도록 memory block의 hotplug 가능성을 유지하려 합니다. `ZONE_NORMAL`으로 online한 capacity는 page allocator에 영구적으로 연결된 것으로 보아야 합니다.
Hotplug Memory Block size
41-48대부분의 architecture에서 기본 Hotplug Memory Block Size는 128MB 또는 256MB입니다. x86에서는 전체 memory capacity가 64GB를 넘으면 block size가 최대 2GB까지 커집니다.
v6.15 기준 Linux는 Hotplug Memory Block Size를 결정할 때 ACPI CEDT CFMWS region의 size와 alignment를 고려하지 않습니다. 관련 내용은 Early Boot 문서를 참조하십시오.
Memory Map 위치
49-70hotplug된 memory capacity를 나타내는 `struct folio` 할당 위치는 다음 system 설정이 결정합니다.
- `/sys_module/memory_hotplug/parameters/memmap_on_memory`
- `/sys/bus/dax/devices/daxN.Y/memmap_on_memory`
두 parameter가 모두 true이면 이 capacity의 `struct folio`는 online되는 memory block 자체에서 떼어 냅니다. memory latency가 특히 높고 그 `struct folio`에 경쟁이 집중되면 성능에 영향을 줄 수 있습니다.
둘 중 하나라도 false이면 이 capacity의 `struct folio`는 hotplug 절차를 실행하는 processor의 local node에서 할당합니다. `GFP_KERNEL` 할당이므로 해당 node의 `ZONE_NORMAL` capacity를 사용합니다.
CXL memory pool처럼 `ZONE_MOVABLE` memory가 매우 많은 system은 hotplug capacity의 memory map을 수용할 local `ZONE_NORMAL` capacity가 충분한지 확인해야 합니다.
Driver Managed Memory
71-78DAX driver는 이 memory를 memory-hotplug에 `Driver Managed`로 노출합니다. 이는 사용자가 구성할 수 있는 설정이 아닙니다.
driver managed memory는 kexec 사용 대상에서 명시적으로 제외됩니다. 정상적인 system reboot 중 CXL device에 reset-on-probe 같은 reset 또는 out-of-band 작업이 일어나더라도 kexec kernel의 일부가 덮어써지지 않게 하기 위해 필요합니다.
요약과 해설
memory-hotplug.rst:1-78CXL DAX capacity를 page allocator에 편입할 때는 online 상태와 zone, block size, memory map metadata 위치를 함께 설계해야 합니다. `ZONE_MOVABLE`은 hot-unplug 가능성을 높이지만 metadata용 `ZONE_NORMAL` capacity가 별도로 필요하며, Driver Managed 표시는 kexec가 이 memory를 사용하지 못하게 합니다.