요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
1
=====================
2
CMA Debugfs Interface
3
=====================
5
The CMA debugfs interface is useful to retrieve basic information out of the
6
different CMA areas and to test allocation/release in each of the areas.
8
Each CMA area represents a directory under <debugfs>/cma/, represented by
9
its CMA name like below:
11
<debugfs>/cma/<cma_name>
13
The structure of the files created under that directory is as follows:
15
- [RO] base_pfn: The base PFN (Page Frame Number) of the CMA area.
16
This is the same as ranges/0/base_pfn.
17
- [RO] count: Amount of memory in the CMA area.
18
- [RO] order_per_bit: Order of pages represented by one bit.
19
- [RO] bitmap: The bitmap of allocated pages in the area.
20
This is the same as ranges/0/base_pfn.
21
- [RO] ranges/N/base_pfn: The base PFN of contiguous range N
22
in the CMA area.
23
- [RO] ranges/N/bitmap: The bit map of allocated pages in
24
range N in the CMA area.
25
- [WO] alloc: Allocate N pages from that CMA area. For example::
27
echo 5 > <debugfs>/cma/<cma_name>/alloc
29
would try to allocate 5 pages from the 'cma_name' area.
31
- [WO] free: Free N pages from that CMA area, similar to the above.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
CMA debugfs 개요
1-14CMA debugfs interface는 여러 CMA 영역의 기본 정보를 조회하고 각 영역에서 allocation/release를 시험하는 데 사용합니다.
각 CMA 영역은 이름을 사용해 `<debugfs>/cma/<cma_name>` directory로 나타납니다. 그 아래에는 다음 file이 생성됩니다.
CMA 영역 file
15-24| File | Access | 의미 |
|---|---|---|
| base_pfn | RO | CMA 영역의 base PFN(Page Frame Number)입니다. ranges/0/base_pfn과 같습니다. |
| count | RO | CMA 영역에 들어 있는 memory 양입니다. |
| order_per_bit | RO | bitmap 한 bit가 나타내는 page order입니다. |
| bitmap | RO | 영역에서 할당된 page의 bitmap입니다. 원문은 ranges/0/base_pfn과 같다고 명시합니다. |
| ranges/N/base_pfn | RO | CMA 영역에서 N번째 contiguous range의 base PFN입니다. |
| ranges/N/bitmap | RO | CMA 영역의 N번째 range에서 할당된 page bitmap입니다. |
Page 할당과 해제
25-31write-only `alloc`에 N을 쓰면 해당 CMA 영역에서 N page 할당을 시도합니다. 다음 예는 `cma_name` 영역에서 5 page를 할당합니다.
echo 5 > <debugfs>/cma/<cma_name>/alloc
write-only `free`에 N을 쓰면 위와 같은 방식으로 해당 CMA 영역의 N page를 해제합니다.
| File | Access | 동작 |
|---|---|---|
| alloc | WO | 해당 CMA 영역에서 N page를 할당합니다. |
| free | WO | 같은 방식으로 해당 CMA 영역의 N page를 해제합니다. |
CMA debugfs 작업 흐름
cma_debugfs.rst:1-31`<debugfs>/cma/<cma_name>`에서 영역의 layout과 allocation 상태를 읽고 `alloc`, `free`에 page 수를 써서 동작을 검증합니다.