Documentation/driver-api/cxl/linux/memory-hotplug.rst GitHub 원문 ↗

Linux 6.18.37 · Driver API / CXL / Linux

Memory Hotplug

CXL memory block의 기본 online zone, block size, struct folio 위치와 Driver Managed 지정의 영향을 설명합니다.

Source pathDocumentation/driver-api/cxl/linux/memory-hotplug.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

memory-hotplug.rst:1-78

CXL DAX capacity를 page allocator에 편입할 때는 online 상태와 zone, block size, memory map metadata 위치를 함께 설계해야 합니다. `ZONE_MOVABLE`은 hot-unplug 가능성을 높이지만 metadata용 `ZONE_NORMAL` capacity가 별도로 필요하며, Driver Managed 표시는 kexec가 이 memory를 사용하지 못하게 합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 ==============
4 Memory Hotplug
5 ==============
6 The final phase of surfacing CXL memory to the kernel page allocator is for
7 the `DAX` driver to surface a `Driver Managed` memory region via the
8 memory-hotplug component.
9
10 There are four major configurations to consider:
11
12 1) Default Online Behavior (on/off and zone)
13 2) Hotplug Memory Block size
14 3) Memory Map Resource location
15 4) Driver-Managed Memory Designation
16
17 Default Online Behavior
18 =======================
19 The default-online behavior of hotplug memory is dictated by the following,
20 in order of precedence:
21
22 - :code:`CONFIG_MHP_DEFAULT_ONLINE_TYPE` Build Configuration
23 - :code:`memhp_default_state` Boot parameter
24 - :code:`/sys/devices/system/memory/auto_online_blocks` value
25
26 These dictate whether hotplugged memory blocks arrive in one of three states:
27
28 1) Offline
29 2) Online in :code:`ZONE_NORMAL`
30 3) Online in :code:`ZONE_MOVABLE`
31
32 :code:`ZONE_NORMAL` implies this capacity may be used for almost any allocation,
33 while :code:`ZONE_MOVABLE` implies this capacity should only be used for
34 migratable allocations.
35
36 :code:`ZONE_MOVABLE` attempts to retain the hotplug-ability of a memory block
37 so that it the entire region may be hot-unplugged at a later time. Any capacity
38 onlined into :code:`ZONE_NORMAL` should be considered permanently attached to
39 the page allocator.
40
41 Hotplug Memory Block Size
42 =========================
43 By default, on most architectures, the Hotplug Memory Block Size is either
44 128MB or 256MB. On x86, the block size increases up to 2GB as total memory
45 capacity exceeds 64GB. As of v6.15, Linux does not take into account the
46 size and alignment of the ACPI CEDT CFMWS regions (see Early Boot docs) when
47 deciding the Hotplug Memory Block Size.
48
49 Memory Map
50 ==========
51 The location of :code:`struct folio` allocations to represent the hotplugged
52 memory capacity are dictated by the following system settings:
53
54 - :code:`/sys_module/memory_hotplug/parameters/memmap_on_memory`
55 - :code:`/sys/bus/dax/devices/daxN.Y/memmap_on_memory`
56
57 If both of these parameters are set to true, :code:`struct folio` for this
58 capacity will be carved out of the memory block being onlined. This has
59 performance implications if the memory is particularly high-latency and
60 its :code:`struct folio` becomes hotly contended.
61
62 If either parameter is set to false, :code:`struct folio` for this capacity
63 will be allocated from the local node of the processor running the hotplug
64 procedure. This capacity will be allocated from :code:`ZONE_NORMAL` on
65 that node, as it is a :code:`GFP_KERNEL` allocation.
66
67 Systems with extremely large amounts of :code:`ZONE_MOVABLE` memory (e.g.
68 CXL memory pools) must ensure that there is sufficient local
69 :code:`ZONE_NORMAL` capacity to host the memory map for the hotplugged capacity.
70
71 Driver Managed Memory
72 =====================
73 The DAX driver surfaces this memory to memory-hotplug as "Driver Managed". This
74 is not a configurable setting, but it's important to note that driver managed
75 memory is explicitly excluded from use during kexec. This is required to ensure
76 any reset or out-of-band operations that the CXL device may be subject to during
77 a functional system-reboot (such as a reset-on-probe) will not cause portions of
78 the kexec kernel to be overwritten.
79

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-40

hotplug 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-70

hotplug된 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-78

DAX driver는 이 memory를 memory-hotplug에 `Driver Managed`로 노출합니다. 이는 사용자가 구성할 수 있는 설정이 아닙니다.

driver managed memory는 kexec 사용 대상에서 명시적으로 제외됩니다. 정상적인 system reboot 중 CXL device에 reset-on-probe 같은 reset 또는 out-of-band 작업이 일어나더라도 kexec kernel의 일부가 덮어써지지 않게 하기 위해 필요합니다.