요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
====================
High Memory Handling
====================
By: Peter Zijlstra <[email protected]>
.. contents:: :local:
What Is High Memory?
====================
High memory (highmem) is used when the size of physical memory approaches or
exceeds the maximum size of virtual memory. At that point it becomes
impossible for the kernel to keep all of the available physical memory mapped
at all times. This means the kernel needs to start using temporary mappings of
the pieces of physical memory that it wants to access.
The part of (physical) memory not covered by a permanent mapping is what we
refer to as 'highmem'. There are various architecture dependent constraints on
where exactly that border lies.
In the i386 arch, for example, we choose to map the kernel into every process's
VM space so that we don't have to pay the full TLB invalidation costs for
kernel entry/exit. This means the available virtual memory space (4GiB on
i386) has to be divided between user and kernel space.
The traditional split for architectures using this approach is 3:1, 3GiB for
userspace and the top 1GiB for kernel space::
+--------+ 0xffffffff
| Kernel |
+--------+ 0xc0000000
| |
| User |
| |
+--------+ 0x00000000
This means that the kernel can at most map 1GiB of physical memory at any one
time, but because we need virtual address space for other things - including
temporary maps to access the rest of the physical memory - the actual direct
map will typically be less (usually around ~896MiB).
Other architectures that have mm context tagged TLBs can have separate kernel
and user maps. Some hardware (like some ARMs), however, have limited virtual
space when they use mm context tags.
Temporary Virtual Mappings
==========================
The kernel contains several ways of creating temporary mappings. The following
list shows them in order of preference of use.
* kmap_local_page(), kmap_local_folio() - These functions are used to create
short term mappings. They can be invoked from any context (including
interrupts) but the mappings can only be used in the context which acquired
them. The only differences between them consist in the first taking a pointer
to a struct page and the second taking a pointer to struct folio and the byte
offset within the folio which identifies the page.
These functions should always be used, whereas kmap_atomic() and kmap() have
been deprecated.
These mappings are thread-local and CPU-local, meaning that the mapping
can only be accessed from within this thread and the thread is bound to the
CPU while the mapping is active. Although preemption is never disabled by
this function, the CPU can not be unplugged from the system via
CPU-hotplug until the mapping is disposed.
It's valid to take pagefaults in a local kmap region, unless the context
in which the local mapping is acquired does not allow it for other reasons.
As said, pagefaults and preemption are never disabled. There is no need to
disable preemption because, when context switches to a different task, the
maps of the outgoing task are saved and those of the incoming one are
restored.
kmap_local_page(), as well as kmap_local_folio() always returns valid virtual
kernel addresses and it is assumed that kunmap_local() will never fail.
On CONFIG_HIGHMEM=n kernels and for low memory pages they return the
virtual address of the direct mapping. Only real highmem pages are
temporarily mapped. Therefore, users may call a plain page_address()
for pages which are known to not come from ZONE_HIGHMEM. However, it is
always safe to use kmap_local_{page,folio}() / kunmap_local().
While they are significantly faster than kmap(), for the highmem case they
come with restrictions about the pointers validity. Contrary to kmap()
mappings, the local mappings are only valid in the context of the caller
and cannot be handed to other contexts. This implies that users must
be absolutely sure to keep the use of the return address local to the
thread which mapped it.
Most code can be designed to use thread local mappings. User should
therefore try to design their code to avoid the use of kmap() by mapping
pages in the same thread the address will be used and prefer
kmap_local_page() or kmap_local_folio().
Nesting kmap_local_page() and kmap_atomic() mappings is allowed to a certain
extent (up to KMAP_TYPE_NR) but their invocations have to be strictly ordered
because the map implementation is stack based. See kmap_local_page() kdocs
(included in the "Functions" section) for details on how to manage nested
mappings.
* kmap_atomic(). This function has been deprecated; use kmap_local_page().
NOTE: Conversions to kmap_local_page() must take care to follow the mapping
restrictions imposed on kmap_local_page(). Furthermore, the code between
calls to kmap_atomic() and kunmap_atomic() may implicitly depend on the side
effects of atomic mappings, i.e. disabling page faults or preemption, or both.
In that case, explicit calls to pagefault_disable() or preempt_disable() or
both must be made in conjunction with the use of kmap_local_page().
[Legacy documentation]
This permits a very short duration mapping of a single page. Since the
mapping is restricted to the CPU that issued it, it performs well, but
the issuing task is therefore required to stay on that CPU until it has
finished, lest some other task displace its mappings.
kmap_atomic() may also be used by interrupt contexts, since it does not
sleep and the callers too may not sleep until after kunmap_atomic() is
called.
Each call of kmap_atomic() in the kernel creates a non-preemptible section
and disable pagefaults. This could be a source of unwanted latency. Therefore
users should prefer kmap_local_page() instead of kmap_atomic().
It is assumed that k[un]map_atomic() won't fail.
* kmap(). This function has been deprecated; use kmap_local_page().
NOTE: Conversions to kmap_local_page() must take care to follow the mapping
restrictions imposed on kmap_local_page(). In particular, it is necessary to
make sure that the kernel virtual memory pointer is only valid in the thread
that obtained it.
[Legacy documentation]
This should be used to make short duration mapping of a single page with no
restrictions on preemption or migration. It comes with an overhead as mapping
space is restricted and protected by a global lock for synchronization. When
mapping is no longer needed, the address that the page was mapped to must be
released with kunmap().
Mapping changes must be propagated across all the CPUs. kmap() also
requires global TLB invalidation when the kmap's pool wraps and it might
block when the mapping space is fully utilized until a slot becomes
available. Therefore, kmap() is only callable from preemptible context.
All the above work is necessary if a mapping must last for a relatively
long time but the bulk of high-memory mappings in the kernel are
short-lived and only used in one place. This means that the cost of
kmap() is mostly wasted in such cases. kmap() was not intended for long
term mappings but it has morphed in that direction and its use is
strongly discouraged in newer code and the set of the preceding functions
should be preferred.
On 64-bit systems, calls to kmap_local_page(), kmap_atomic() and kmap() have
no real work to do because a 64-bit address space is more than sufficient to
address all the physical memory whose pages are permanently mapped.
* vmap(). This can be used to make a long duration mapping of multiple
physical pages into a contiguous virtual space. It needs global
synchronization to unmap.
Cost of Temporary Mappings
==========================
The cost of creating temporary mappings can be quite high. The arch has to
manipulate the kernel's page tables, the data TLB and/or the MMU's registers.
If CONFIG_HIGHMEM is not set, then the kernel will try and create a mapping
simply with a bit of arithmetic that will convert the page struct address into
a pointer to the page contents rather than juggling mappings about. In such a
case, the unmap operation may be a null operation.
If CONFIG_MMU is not set, then there can be no temporary mappings and no
highmem. In such a case, the arithmetic approach will also be used.
i386 PAE
========
The i386 arch, under some circumstances, will permit you to stick up to 64GiB
of RAM into your 32-bit machine. This has a number of consequences:
* Linux needs a page-frame structure for each page in the system and the
pageframes need to live in the permanent mapping, which means:
* you can have 896M/sizeof(struct page) page-frames at most; with struct
page being 32-bytes that would end up being something in the order of 112G
worth of pages; the kernel, however, needs to store more than just
page-frames in that memory...
* PAE makes your page tables larger - which slows the system down as more
data has to be accessed to traverse in TLB fills and the like. One
advantage is that PAE has more PTE bits and can provide advanced features
like NX and PAT.
The general recommendation is that you don't use more than 8GiB on a 32-bit
machine - although more might work for you and your workload, you're pretty
much on your own - don't expect kernel developers to really care much if things
come apart.
Functions
=========
.. kernel-doc:: include/linux/highmem.h
.. kernel-doc:: mm/highmem.c
.. kernel-doc:: include/linux/highmem-internal.h
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
High memory의 의미
1-20이 문서는 Peter Zijlstra가 작성한 high memory 처리 가이드입니다. High memory, 즉 highmem은 물리 메모리 크기가 가상 메모리의 최대 크기에 가까워지거나 이를 넘을 때 사용합니다.
이 시점에는 커널이 사용 가능한 모든 물리 메모리를 항상 mapping해 둘 수 없으므로 접근하려는 물리 메모리 조각에 임시 mapping을 만들어야 합니다. 영구 mapping이 덮지 않는 물리 메모리 부분을 `highmem`이라고 하며, 정확한 경계는 아키텍처별 제약에 따라 달라집니다.
====================
High Memory Handling
====================
By: Peter Zijlstra <[email protected]>
.. contents:: :local:
What Is High Memory?
====================
High memory (highmem) is used when the size of physical memory approaches or
exceeds the maximum size of virtual memory. At that point it becomes
impossible for the kernel to keep all of the available physical memory mapped
at all times. This means the kernel needs to start using temporary mappings of
the pieces of physical memory that it wants to access.
The part of (physical) memory not covered by a permanent mapping is what we
refer to as 'highmem'. There are various architecture dependent constraints on
where exactly that border lies.
i386의 3:1 가상 주소 공간
21-47i386에서는 kernel entry와 exit 때 전체 TLB invalidation 비용을 내지 않도록 커널을 모든 프로세스의 VM 공간에 mapping합니다. 따라서 i386의 4 GiB 가상 메모리 공간을 사용자 공간과 커널 공간으로 나눠야 합니다.
이 방식을 쓰는 아키텍처의 전통적인 분할은 사용자 공간 3 GiB와 위쪽 커널 공간 1 GiB의 3:1입니다.
원문의 세로 ASCII 배치를 주소 범위 표로 다시 구성했습니다.
커널이 한 번에 mapping할 수 있는 물리 메모리는 최대 1 GiB이지만, 나머지 물리 메모리에 접근하는 임시 map 등 다른 용도로도 가상 주소 공간이 필요하므로 실제 direct map은 보통 약 896 MiB보다 작습니다.
MM context tag가 붙은 TLB를 가진 다른 아키텍처는 kernel map과 user map을 분리할 수 있습니다. 그러나 일부 ARM 같은 하드웨어는 MM context tag를 사용할 때 가상 공간이 제한됩니다.
In the i386 arch, for example, we choose to map the kernel into every process's
VM space so that we don't have to pay the full TLB invalidation costs for
kernel entry/exit. This means the available virtual memory space (4GiB on
i386) has to be divided between user and kernel space.
The traditional split for architectures using this approach is 3:1, 3GiB for
userspace and the top 1GiB for kernel space::
+--------+ 0xffffffff
| Kernel |
+--------+ 0xc0000000
| |
| User |
| |
+--------+ 0x00000000
This means that the kernel can at most map 1GiB of physical memory at any one
time, but because we need virtual address space for other things - including
temporary maps to access the rest of the physical memory - the actual direct
map will typically be less (usually around ~896MiB).
Other architectures that have mm context tagged TLBs can have separate kernel
and user maps. Some hardware (like some ARMs), however, have limited virtual
space when they use mm context tags.
kmap_local_page()와 kmap_local_folio()
48-104커널에는 여러 임시 mapping 방식이 있으며 선호 순서는 `kmap_local_page()`와 `kmap_local_folio()`가 가장 앞입니다. 이 함수들은 짧은 기간의 mapping을 만들고 interrupt를 포함한 모든 context에서 호출할 수 있지만, mapping을 획득한 context 안에서만 사용할 수 있습니다.
`kmap_local_page()`는 `struct page` pointer를 받고, `kmap_local_folio()`는 `struct folio` pointer와 folio 안의 page를 식별하는 byte offset을 받는다는 점만 다릅니다. Deprecated된 `kmap_atomic()`과 `kmap()` 대신 항상 이 함수들을 사용해야 합니다.
이 mapping은 thread-local이자 CPU-local입니다. Mapping은 해당 thread 안에서만 접근할 수 있고, 활성화된 동안 thread는 CPU에 묶입니다. 함수가 preemption을 끄지는 않지만 mapping이 해제될 때까지 CPU-hotplug로 해당 CPU를 시스템에서 unplug할 수 없습니다.
Local kmap region에서 page fault를 일으키는 것은 유효합니다. 다만 local mapping을 얻은 context가 다른 이유로 page fault를 허용하지 않는 경우는 예외입니다. Page fault와 preemption은 비활성화되지 않으며, context switch 때 나가는 task의 map을 저장하고 들어오는 task의 map을 복원하므로 preemption을 끌 필요가 없습니다.
`kmap_local_page()`와 `kmap_local_folio()`는 항상 유효한 virtual kernel address를 반환하며 `kunmap_local()`은 실패하지 않는다고 가정합니다.
`CONFIG_HIGHMEM=n` 커널과 low memory page에서는 direct mapping의 가상 주소를 반환하고 실제 highmem page만 임시 mapping합니다. `ZONE_HIGHMEM`에서 오지 않았다는 사실을 아는 page에는 평범한 `page_address()`를 호출할 수 있지만, `kmap_local_{page,folio}()`와 `kunmap_local()` 조합은 언제나 안전합니다.
이 함수들은 `kmap()`보다 훨씬 빠르지만 highmem에서는 pointer 유효 범위가 제한됩니다. Local mapping은 호출자 context 안에서만 유효해 다른 context로 전달할 수 없으므로 반환 주소의 사용을 mapping한 thread 안에 엄격히 한정해야 합니다.
대부분의 코드는 page를 주소를 사용할 같은 thread에서 mapping해 thread-local mapping을 쓸 수 있도록 설계할 수 있습니다. 따라서 `kmap()`을 피하고 `kmap_local_page()` 또는 `kmap_local_folio()`를 선호해야 합니다.
`kmap_local_page()`와 `kmap_atomic()` mapping은 `KMAP_TYPE_NR`까지 중첩할 수 있지만 구현이 stack 기반이므로 호출 순서를 엄격히 지켜야 합니다. 자세한 중첩 관리 방법은 Functions 절에 포함된 `kmap_local_page()` kernel-doc을 참조합니다.
Temporary Virtual Mappings
==========================
The kernel contains several ways of creating temporary mappings. The following
list shows them in order of preference of use.
* kmap_local_page(), kmap_local_folio() - These functions are used to create
short term mappings. They can be invoked from any context (including
interrupts) but the mappings can only be used in the context which acquired
them. The only differences between them consist in the first taking a pointer
to a struct page and the second taking a pointer to struct folio and the byte
offset within the folio which identifies the page.
These functions should always be used, whereas kmap_atomic() and kmap() have
been deprecated.
These mappings are thread-local and CPU-local, meaning that the mapping
can only be accessed from within this thread and the thread is bound to the
CPU while the mapping is active. Although preemption is never disabled by
this function, the CPU can not be unplugged from the system via
CPU-hotplug until the mapping is disposed.
It's valid to take pagefaults in a local kmap region, unless the context
in which the local mapping is acquired does not allow it for other reasons.
As said, pagefaults and preemption are never disabled. There is no need to
disable preemption because, when context switches to a different task, the
maps of the outgoing task are saved and those of the incoming one are
restored.
kmap_local_page(), as well as kmap_local_folio() always returns valid virtual
kernel addresses and it is assumed that kunmap_local() will never fail.
On CONFIG_HIGHMEM=n kernels and for low memory pages they return the
virtual address of the direct mapping. Only real highmem pages are
temporarily mapped. Therefore, users may call a plain page_address()
for pages which are known to not come from ZONE_HIGHMEM. However, it is
always safe to use kmap_local_{page,folio}() / kunmap_local().
While they are significantly faster than kmap(), for the highmem case they
come with restrictions about the pointers validity. Contrary to kmap()
mappings, the local mappings are only valid in the context of the caller
and cannot be handed to other contexts. This implies that users must
be absolutely sure to keep the use of the return address local to the
thread which mapped it.
Most code can be designed to use thread local mappings. User should
therefore try to design their code to avoid the use of kmap() by mapping
pages in the same thread the address will be used and prefer
kmap_local_page() or kmap_local_folio().
Nesting kmap_local_page() and kmap_atomic() mappings is allowed to a certain
extent (up to KMAP_TYPE_NR) but their invocations have to be strictly ordered
because the map implementation is stack based. See kmap_local_page() kdocs
(included in the "Functions" section) for details on how to manage nested
mappings.
Deprecated kmap_atomic()
105-130`kmap_atomic()`은 deprecated됐으므로 `kmap_local_page()`를 사용해야 합니다. 전환할 때는 `kmap_local_page()`의 mapping 제한을 지켜야 합니다.
기존 `kmap_atomic()`과 `kunmap_atomic()` 사이 코드는 atomic mapping의 부수 효과인 page fault 또는 preemption 비활성화에 암묵적으로 의존할 수 있습니다. 그런 경우 `kmap_local_page()`로 전환하면서 `pagefault_disable()`이나 `preempt_disable()` 또는 둘 다를 명시적으로 호출해야 합니다.
Legacy 동작에서 `kmap_atomic()`은 page 하나를 매우 짧게 mapping합니다. Mapping이 요청한 CPU에 한정되므로 빠르지만, 다른 task가 mapping을 밀어내지 않도록 완료할 때까지 요청 task가 그 CPU에 머물러야 합니다.
Sleep하지 않으므로 interrupt context에서도 쓸 수 있지만 호출자 역시 `kunmap_atomic()`을 부를 때까지 sleep할 수 없습니다. 호출할 때마다 non-preemptible section을 만들고 page fault를 비활성화해 원치 않는 latency를 만들 수 있으므로 `kmap_local_page()`를 선호해야 합니다. `k[un]map_atomic()`은 실패하지 않는다고 가정합니다.
* kmap_atomic(). This function has been deprecated; use kmap_local_page().
NOTE: Conversions to kmap_local_page() must take care to follow the mapping
restrictions imposed on kmap_local_page(). Furthermore, the code between
calls to kmap_atomic() and kunmap_atomic() may implicitly depend on the side
effects of atomic mappings, i.e. disabling page faults or preemption, or both.
In that case, explicit calls to pagefault_disable() or preempt_disable() or
both must be made in conjunction with the use of kmap_local_page().
[Legacy documentation]
This permits a very short duration mapping of a single page. Since the
mapping is restricted to the CPU that issued it, it performs well, but
the issuing task is therefore required to stay on that CPU until it has
finished, lest some other task displace its mappings.
kmap_atomic() may also be used by interrupt contexts, since it does not
sleep and the callers too may not sleep until after kunmap_atomic() is
called.
Each call of kmap_atomic() in the kernel creates a non-preemptible section
and disable pagefaults. This could be a source of unwanted latency. Therefore
users should prefer kmap_local_page() instead of kmap_atomic().
It is assumed that k[un]map_atomic() won't fail.
Deprecated kmap()과 장기 vmap()
131-167`kmap()`도 deprecated됐으므로 `kmap_local_page()`를 사용해야 합니다. 전환할 때 특히 kernel virtual memory pointer가 이를 얻은 thread에서만 유효하다는 제한을 지켜야 합니다.
Legacy `kmap()`은 preemption이나 migration 제한 없이 page 하나를 짧게 mapping하는 용도였습니다. Mapping 공간이 제한되고 동기화를 위한 global lock으로 보호되므로 오버헤드가 있습니다. Mapping이 더 필요 없으면 `kunmap()`으로 page가 mapping된 주소를 해제해야 합니다.
Mapping 변경은 모든 CPU에 전파해야 합니다. `kmap()` pool이 wrap되면 global TLB invalidation도 필요하고, mapping 공간이 가득 차면 slot이 생길 때까지 block할 수 있으므로 preemptible context에서만 호출할 수 있습니다.
상대적으로 긴 mapping이 꼭 필요하다면 이 작업이 필요하지만, 커널의 high-memory mapping 대부분은 짧고 한곳에서만 사용되므로 `kmap()` 비용은 대개 낭비입니다. `kmap()`은 본래 장기 mapping용이 아니었으나 그 방향으로 변해 왔고, 새 코드에서는 사용을 강하게 피하며 앞의 local 함수들을 선호해야 합니다.
64-bit 시스템에서는 주소 공간이 영구 mapping된 모든 물리 메모리를 다루기에 충분하므로 `kmap_local_page()`, `kmap_atomic()`, `kmap()` 호출이 실제 mapping 작업을 할 필요가 없습니다.
`vmap()`은 여러 물리 page를 연속된 가상 공간에 장기간 mapping할 때 사용합니다. Unmap에는 global synchronization이 필요합니다.
* kmap(). This function has been deprecated; use kmap_local_page().
NOTE: Conversions to kmap_local_page() must take care to follow the mapping
restrictions imposed on kmap_local_page(). In particular, it is necessary to
make sure that the kernel virtual memory pointer is only valid in the thread
that obtained it.
[Legacy documentation]
This should be used to make short duration mapping of a single page with no
restrictions on preemption or migration. It comes with an overhead as mapping
space is restricted and protected by a global lock for synchronization. When
mapping is no longer needed, the address that the page was mapped to must be
released with kunmap().
Mapping changes must be propagated across all the CPUs. kmap() also
requires global TLB invalidation when the kmap's pool wraps and it might
block when the mapping space is fully utilized until a slot becomes
available. Therefore, kmap() is only callable from preemptible context.
All the above work is necessary if a mapping must last for a relatively
long time but the bulk of high-memory mappings in the kernel are
short-lived and only used in one place. This means that the cost of
kmap() is mostly wasted in such cases. kmap() was not intended for long
term mappings but it has morphed in that direction and its use is
strongly discouraged in newer code and the set of the preceding functions
should be preferred.
On 64-bit systems, calls to kmap_local_page(), kmap_atomic() and kmap() have
no real work to do because a 64-bit address space is more than sufficient to
address all the physical memory whose pages are permanently mapped.
* vmap(). This can be used to make a long duration mapping of multiple
physical pages into a contiguous virtual space. It needs global
synchronization to unmap.
임시 mapping 비용
168-181임시 mapping 생성 비용은 상당히 클 수 있습니다. 아키텍처가 kernel page table, data TLB 또는 MMU register를 조작해야 하기 때문입니다.
`CONFIG_HIGHMEM`이 설정되지 않았다면 커널은 mapping을 바꾸는 대신 `struct page` 주소를 page 내용 pointer로 변환하는 간단한 산술 연산으로 mapping을 만들려고 합니다. 이 경우 unmap은 아무 작업도 하지 않을 수 있습니다.
`CONFIG_MMU`가 설정되지 않으면 임시 mapping과 highmem 자체가 존재할 수 없으며, 이때도 산술 변환 방식을 사용합니다.
Cost of Temporary Mappings
==========================
The cost of creating temporary mappings can be quite high. The arch has to
manipulate the kernel's page tables, the data TLB and/or the MMU's registers.
If CONFIG_HIGHMEM is not set, then the kernel will try and create a mapping
simply with a bit of arithmetic that will convert the page struct address into
a pointer to the page contents rather than juggling mappings about. In such a
case, the unmap operation may be a null operation.
If CONFIG_MMU is not set, then there can be no temporary mappings and no
highmem. In such a case, the arithmetic approach will also be used.
i386 PAE의 영향과 권장 한계
182-205일부 조건에서 i386 PAE는 32-bit machine에 최대 64 GiB RAM을 장착하게 합니다. Linux는 시스템의 각 page마다 영구 mapping 안에 존재해야 하는 page-frame 구조체를 필요로 합니다.
따라서 page-frame 수의 이론적 상한은 `896M / sizeof(struct page)`입니다. `struct page`가 32 byte라면 약 112 GiB 분량의 page에 해당하지만, 커널은 그 영구 mapping 메모리에 page-frame 이외의 데이터도 저장해야 합니다.
PAE는 page table을 더 크게 만들어 TLB fill 등에서 순회할 데이터가 늘고 시스템이 느려집니다. 장점은 PTE bit가 더 많아 NX와 PAT 같은 고급 기능을 제공할 수 있다는 점입니다.
일반적인 권장은 32-bit machine에서 8 GiB보다 많은 메모리를 사용하지 않는 것입니다. 더 많은 메모리가 특정 workload에서 동작할 수는 있지만 문제가 생기면 사실상 사용자가 스스로 해결해야 하며 kernel developer의 적극적인 지원을 기대하기 어렵습니다.
i386 PAE
========
The i386 arch, under some circumstances, will permit you to stick up to 64GiB
of RAM into your 32-bit machine. This has a number of consequences:
* Linux needs a page-frame structure for each page in the system and the
pageframes need to live in the permanent mapping, which means:
* you can have 896M/sizeof(struct page) page-frames at most; with struct
page being 32-bytes that would end up being something in the order of 112G
worth of pages; the kernel, however, needs to store more than just
page-frames in that memory...
* PAE makes your page tables larger - which slows the system down as more
data has to be accessed to traverse in TLB fills and the like. One
advantage is that PAE has more PTE bits and can provide advanced features
like NX and PAT.
The general recommendation is that you don't use more than 8GiB on a 32-bit
machine - although more might work for you and your workload, you're pretty
much on your own - don't expect kernel developers to really care much if things
come apart.
관련 함수 reference
206-213High memory 관련 함수 reference는 `include/linux/highmem.h`, `mm/highmem.c`, `include/linux/highmem-internal.h`의 kernel-doc에서 생성됩니다.
Functions
=========
.. kernel-doc:: include/linux/highmem.h
.. kernel-doc:: mm/highmem.c
.. kernel-doc:: include/linux/highmem-internal.h
요약·해설
highmem.rst:1-213Highmem은 커널의 영구 virtual mapping이 덮지 못하는 물리 메모리입니다. 필요한 page에 임시 mapping을 만들되, 현대 코드는 짧은 thread-local 사용에 `kmap_local_page()` 또는 `kmap_local_folio()`를 우선하고 deprecated된 `kmap_atomic()`과 `kmap()`을 피해야 합니다.
전통적인 3:1 분할과 실제 direct-map 한계를 나타냅니다.
Mapping 기간과 pointer 유효 범위에 따른 권장 선택입니다.
반환 pointer를 획득한 thread 밖으로 넘기지 않고 stack 순서로 해제합니다.