On x86 architecture, "Extended paging" allows page frames (physical memory) to be 4 MB instead of 4 KB.
The book "Understanding the Linux Kernel, 3rd" at chapter 2 "Memory Addressing", sub-chapter "Paging in Linux", section "Kernel Page Tables", explains that for the final kernel Page Table when RAM size is less than 896 MB:
[...]the kernel can address the RAM by making use of large pages (see the section "Extended Paging" earlier in this chapter).
However, in the section "Extended Paging" (sub-chapter "Paging in Hardware"), it is written :
Extended paging coexists with regular paging.
I don't actually get how extended and regular paging coexist. Can please someone explain those questions:
- In which cases the kernel uses 4 MB pages? or 4 KB pages?
- Which page frame size will be used for kmalloc operations? for vmalloc?
- If we assume that the initial code & data (kernel's segments, provisional Page Tables, and 128 KB for dynamic data) fit in the first 8 MB of RAM (as the example given by the book), what if the real amount of code & data is 5MB only: will the kernel waste 8 - 5 = 3 MB?