요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
====================
DAX Driver Operation
====================
The `Direct Access Device` driver was originally designed to provide a
memory-like access mechanism to memory-like block-devices. It was
extended to support CXL Memory Devices, which provide user-configured
memory devices.
The CXL subsystem depends on the DAX subsystem to either:
- Generate a file-like interface to userland via :code:`/dev/daxN.Y`, or
- Engage the memory-hotplug interface to add CXL memory to page allocator.
The DAX subsystem exposes this ability through the `cxl_dax_region` driver.
A `dax_region` provides the translation between a CXL `memory_region` and
a `DAX Device`.
DAX Device
==========
A `DAX Device` is a file-like interface exposed in :code:`/dev/daxN.Y`. A
memory region exposed via dax device can be accessed via userland software
via the :code:`mmap()` system-call. The result is direct mappings to the
CXL capacity in the task's page tables.
Users wishing to manually handle allocation of CXL memory should use this
interface.
kmem conversion
===============
The :code:`dax_kmem` driver converts a `DAX Device` into a series of `hotplug
memory blocks` managed by :code:`kernel/memory-hotplug.c`. This capacity
will be exposed to the kernel page allocator in the user-selected memory
zone.
The :code:`memmap_on_memory` setting (both global and DAX device local)
dictates where the kernell will allocate the :code:`struct folio` descriptors
for this memory will come from. If :code:`memmap_on_memory` is set, memory
hotplug will set aside a portion of the memory block capacity to allocate
folios. If unset, the memory is allocated via a normal :code:`GFP_KERNEL`
allocation - and as a result will most likely land on the local NUM node of the
CPU executing the hotplug operation.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
DAX driver 동작
1-18.. SPDX-License-Identifier: GPL-2.0
`Direct Access Device` driver는 원래 memory와 유사한 block device에 memory와 같은 접근 방식을 제공하도록 설계되었습니다. 이후 사용자가 구성한 memory device를 제공하는 CXL Memory Device도 지원하도록 확장되었습니다.
CXL subsystem은 다음 두 작업 중 하나를 위해 DAX subsystem에 의존합니다.
- `/dev/daxN.Y`를 통해 user space에 file과 유사한 interface를 생성합니다.
- memory-hotplug interface를 사용해 CXL memory를 page allocator에 추가합니다.
DAX subsystem은 `cxl_dax_region` driver를 통해 이 기능을 노출합니다. `dax_region`은 CXL `memory_region`과 `DAX Device` 사이의 변환 관계를 제공합니다.
DAX Device
19-29`DAX Device`는 `/dev/daxN.Y`에 노출되는 file과 유사한 interface입니다. DAX device로 노출한 memory region은 user-space software가 `mmap()` system call로 접근할 수 있습니다. 그 결과 task의 page table에는 CXL capacity를 직접 가리키는 mapping이 만들어집니다.
CXL memory 할당을 직접 처리하려는 사용자는 이 interface를 사용해야 합니다.
kmem 전환
30-43`dax_kmem` driver는 `DAX Device`를 `kernel/memory-hotplug.c`가 관리하는 일련의 `hotplug memory block`으로 변환합니다. 이 capacity는 사용자가 선택한 memory zone의 kernel page allocator에 노출됩니다.
전역 설정과 DAX device별 로컬 설정으로 제공되는 `memmap_on_memory`는 이 memory의 `struct folio` descriptor를 kernel이 어디에서 할당할지 결정합니다. `memmap_on_memory`가 설정되어 있으면 memory hotplug가 memory block capacity의 일부를 folio 할당용으로 따로 떼어 둡니다.
설정되어 있지 않으면 일반 `GFP_KERNEL` 할당으로 descriptor memory를 확보합니다. 따라서 이 memory는 hotplug 작업을 실행하는 CPU의 로컬 NUMA node에 배치될 가능성이 큽니다.
요약과 해설
dax-driver.rst:1-43CXL subsystem은 DAX를 통해 user space 직접 mapping과 kernel page allocator 편입이라는 두 사용 모델을 제공합니다. `dax_kmem`과 `memmap_on_memory`의 선택은 capacity뿐 아니라 metadata가 소비되는 NUMA 위치에도 영향을 줍니다.