Documentation/driver-api/cxl/allocation/reclaim.rst GitHub 원문 ↗

Linux 6.18.37 · Driver API / CXL / Allocation

Reclaim

demotion, cpuset, ZSwap을 통한 CXL 메모리의 간접 사용과 제약을 설명합니다.

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

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

1. 요약·해설

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

요약과 해설

reclaim.rst:1-51

demotion, cpuset, ZSwap을 통한 CXL 메모리의 간접 사용과 제약을 설명합니다. 영어 원문 전체와 한국어 전문 번역을 함께 제공하며 directive, 코드, symbol, source path와 원문 줄 좌표를 보존합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =======
4 Reclaim
5 =======
6 Another way CXL memory can be utilized *indirectly* is via the reclaim system
7 in :code:`mm/vmscan.c`. Reclaim is engaged when memory capacity on the system
8 becomes pressured based on global and cgroup-local `watermark` settings.
9
10 In this section we won't discuss the `watermark` configurations, just how CXL
11 memory can be consumed by various pieces of reclaim system.
12
13 Demotion
14 ========
15 By default, the reclaim system will prefer swap (or zswap) when reclaiming
16 memory. Enabling :code:`kernel/mm/numa/demotion_enabled` will cause vmscan
17 to opportunistically prefer distant NUMA nodes to swap or zswap, if capacity
18 is available.
19
20 Demotion engages the :code:`mm/memory_tier.c` component to determine the
21 next demotion node. The next demotion node is based on the :code:`HMAT`
22 or :code:`CDAT` performance data.
23
24 cpusets.mems_allowed quirk
25 --------------------------
26 In Linux v6.15 and below, demotion does not respect :code:`cpusets.mems_allowed`
27 when migrating pages. As a result, if demotion is enabled, vmscan cannot
28 guarantee isolation of a container's memory from nodes not set in mems_allowed.
29
30 In Linux v6.XX and up, demotion does attempt to respect
31 :code:`cpusets.mems_allowed`; however, certain classes of shared memory
32 originally instantiated by another cgroup (such as common libraries - e.g.
33 libc) may still be demoted. As a result, the mems_allowed interface still
34 cannot provide perfect isolation from the remote nodes.
35
36 ZSwap and Node Preference
37 =========================
38 In Linux v6.15 and below, ZSwap allocates memory from the local node of the
39 processor for the new pages being compressed. Since pages being compressed
40 are typically cold, the result is a cold page becomes promoted - only to
41 be later demoted as it ages off the LRU.
42
43 In Linux v6.XX, ZSwap tries to prefer the node of the page being compressed
44 as the allocation target for the compression page. This helps prevent
45 thrashing.
46
47 Demotion with ZSwap
48 ===================
49 When enabling both Demotion and ZSwap, you create a situation where ZSwap
50 will prefer the slowest form of CXL memory by default until that tier of
51 memory is exhausted.
52

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

CXL 메모리와 reclaim

1-12
.. SPDX-License-Identifier: GPL-2.0

CXL 메모리를 간접적으로 사용하는 또 다른 방법은 `mm/vmscan.c`의 reclaim 시스템입니다. 시스템 메모리 용량이 전역 또는 cgroup-local `watermark` 설정에 따라 압박을 받으면 reclaim이 시작됩니다.

이 절은 `watermark` 구성 자체보다 reclaim 시스템의 여러 부분이 CXL 메모리를 소비하는 방식을 설명합니다.

Demotion과 cpuset 제약

13-35

기본적으로 reclaim 시스템은 메모리를 회수할 때 swap 또는 zswap을 선호합니다. `kernel/mm/numa/demotion_enabled`를 활성화하면 가용 용량이 있을 때 vmscan이 swap이나 zswap보다 먼 NUMA node를 기회적으로 우선합니다.

demotion은 다음 demotion node를 결정하기 위해 `mm/memory_tier.c` 구성 요소를 사용합니다. 다음 node는 `HMAT` 또는 `CDAT` 성능 데이터를 기준으로 정합니다.

Linux v6.15 이하에서는 페이지를 이동할 때 demotion이 `cpusets.mems_allowed`를 존중하지 않습니다. 따라서 demotion이 활성화되면 vmscan은 컨테이너의 메모리가 `mems_allowed`에 없는 node로부터 격리된다고 보장할 수 없습니다.

Linux v6.XX 이상에서는 demotion이 `cpusets.mems_allowed`를 따르려고 하지만, 다른 cgroup이 처음 만든 공유 메모리의 일부, 예를 들어 libc 같은 공통 라이브러리는 여전히 demote될 수 있습니다. 따라서 `mems_allowed`도 remote node로부터 완벽한 격리를 제공하지 못합니다.

ZSwap의 node 선택

36-46

Linux v6.15 이하에서 ZSwap은 새 압축 페이지를 처리하는 processor의 local node에서 메모리를 할당합니다. 압축되는 페이지는 보통 cold page이므로, cold page가 일단 승격됐다가 LRU에서 오래되면 다시 demote되는 결과가 생깁니다.

Linux v6.XX에서는 ZSwap이 압축용 페이지의 할당 대상으로 원본 페이지가 있던 node를 우선하려고 하며, 이는 thrashing을 줄이는 데 도움이 됩니다.

Demotion과 ZSwap의 동시 사용

47-51

Demotion과 ZSwap을 함께 활성화하면 가장 느린 CXL 메모리 tier가 고갈될 때까지 ZSwap이 기본적으로 그 tier를 우선하게 됩니다.