← Documents Documentation/mm/remap_file_pages.rst GitHub 원문 ↗

Linux 6.18.37 · Memory management

remap_file_pages() system call

비선형 파일 페이지 매핑의 목적, 커널 비용, 폐기 예정 ABI의 VMA 에뮬레이션을 설명합니다.

Source pathDocumentation/mm/remap_file_pages.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

remap_file_pages.rst:1-31

`remap_file_pages()`는 추가 VMA 없이 파일 페이지를 비연속 순서로 매핑하려던 32비트 시대의 인터페이스입니다. 복잡한 VM hot-path 코드와 희소한 PTE flag를 소비하는 데 비해 사용자가 거의 없어 현재는 새 VMA를 만드는 방식으로 ABI만 에뮬레이션합니다.

비선형 매핑과 현재 에뮬레이션
기존 호출`remap_file_pages()``pte_file` 비선형 PTE추가 VMA 없음
현재 호출ABI 에뮬레이션새 VMA 생성`vm.max_map_count` 부담 증가

ABI는 유지하지만 내부 구현은 비선형 PTE에서 여러 VMA로 바뀌었습니다.

구현 선택의 교환 관계
항목비선형 매핑VMA 에뮬레이션
VMA 수적음증가
Kernel 복잡도높음, hot path 포함낮음
PTE flag`pte_file` 구분에 사용전용 flag 불필요
성능기존 사용자에게 빠름드문 사용자에게 느릴 수 있음
ABI원래 동작보존

과거 장점과 현재 유지 비용을 함께 비교합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ==============================
2 remap_file_pages() system call
3 ==============================
4
5 The remap_file_pages() system call is used to create a nonlinear mapping,
6 that is, a mapping in which the pages of the file are mapped into a
7 nonsequential order in memory. The advantage of using remap_file_pages()
8 over using repeated calls to mmap(2) is that the former approach does not
9 require the kernel to create additional VMA (Virtual Memory Area) data
10 structures.
11
12 Supporting of nonlinear mapping requires significant amount of non-trivial
13 code in kernel virtual memory subsystem including hot paths. Also to get
14 nonlinear mapping work kernel need a way to distinguish normal page table
15 entries from entries with file offset (pte_file). Kernel reserves flag in
16 PTE for this purpose. PTE flags are scarce resource especially on some CPU
17 architectures. It would be nice to free up the flag for other usage.
18
19 Fortunately, there are not many users of remap_file_pages() in the wild.
20 It's only known that one enterprise RDBMS implementation uses the syscall
21 on 32-bit systems to map files bigger than can linearly fit into 32-bit
22 virtual address space. This use-case is not critical anymore since 64-bit
23 systems are widely available.
24
25 The syscall is deprecated and replaced it with an emulation now. The
26 emulation creates new VMAs instead of nonlinear mappings. It's going to
27 work slower for rare users of remap_file_pages() but ABI is preserved.
28
29 One side effect of emulation (apart from performance) is that user can hit
30 vm.max_map_count limit more easily due to additional VMAs. See comment for
31 DEFAULT_MAX_MAP_COUNT for more details on the limit.
32

3. 한국어 전문 번역

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

비선형 파일 페이지 매핑

1-10

`remap_file_pages()` 시스템 호출

`remap_file_pages()` 시스템 호출은 파일 페이지를 메모리에서 연속되지 않은 순서로 배치하는 비선형 매핑을 만드는 데 사용됩니다.

같은 결과를 얻기 위해 `mmap(2)`를 여러 번 호출하는 방식과 달리, `remap_file_pages()`는 커널이 추가 VMA(Virtual Memory Area) 자료 구조를 만들지 않아도 된다는 장점이 있습니다.

==============================
remap_file_pages() system call
==============================

The remap_file_pages() system call is used to create a nonlinear mapping,
that is, a mapping in which the pages of the file are mapped into a
nonsequential order in memory. The advantage of using remap_file_pages()
over using repeated calls to mmap(2) is that the former approach does not
require the kernel to create additional VMA (Virtual Memory Area) data
structures.

커널 비용과 알려진 사용자

11-23

비선형 매핑 지원에는 커널 가상 메모리 하위 시스템의 hot path까지 포함하는 상당량의 복잡한 코드가 필요합니다. 또한 커널은 보통 페이지 테이블 엔트리와 파일 오프셋을 담은 엔트리인 `pte_file`을 구별해야 합니다.

이를 위해 PTE 플래그 하나를 예약하지만, PTE 플래그는 특히 일부 CPU 아키텍처에서 매우 부족한 자원입니다. 다른 용도로 쓸 수 있도록 이 플래그를 되찾는 편이 바람직합니다.

다행히 실제 `remap_file_pages()` 사용자는 많지 않습니다. 알려진 사례는 32비트 가상 주소 공간에 선형으로 들어가지 않을 만큼 큰 파일을 매핑하는 한 엔터프라이즈 RDBMS 구현뿐입니다. 64비트 시스템이 널리 보급된 현재에는 이 사용 사례도 더 이상 중요하지 않습니다.


Supporting of nonlinear mapping requires significant amount of non-trivial
code in kernel virtual memory subsystem including hot paths. Also to get
nonlinear mapping work kernel need a way to distinguish normal page table
entries from entries with file offset (pte_file). Kernel reserves flag in
PTE for this purpose. PTE flags are scarce resource especially on some CPU
architectures. It would be nice to free up the flag for other usage.

Fortunately, there are not many users of remap_file_pages() in the wild.
It's only known that one enterprise RDBMS implementation uses the syscall
on 32-bit systems to map files bigger than can linearly fit into 32-bit
virtual address space. This use-case is not critical anymore since 64-bit
systems are widely available.

폐기 예정 ABI의 VMA 에뮬레이션

24-31

이 시스템 호출은 폐기 예정이며 현재는 에뮬레이션으로 대체되었습니다. 에뮬레이션은 비선형 매핑 대신 새 VMA를 만듭니다. 드문 기존 사용자에게는 느려지지만 ABI는 보존됩니다.

성능 외의 부작용은 추가 VMA 때문에 사용자가 `vm.max_map_count` 한도에 더 쉽게 도달할 수 있다는 점입니다. 한도의 자세한 설명은 `DEFAULT_MAX_MAP_COUNT` 주석을 참고하십시오.


The syscall is deprecated and replaced it with an emulation now. The
emulation creates new VMAs instead of nonlinear mappings. It's going to
work slower for rare users of remap_file_pages() but ABI is preserved.

One side effect of emulation (apart from performance) is that user can hit
vm.max_map_count limit more easily due to additional VMAs. See comment for
DEFAULT_MAX_MAP_COUNT for more details on the limit.