After this documentation was released in July 2003, I was approached
by Prentice Hall and asked to write a book on the Linux VM under the Bruce Peren's Open Book Series.
The book is available and called simply "Understanding The Linux Virtual
Memory Manager". There is a lot of additional material in the book that is
not available here, including details on later 2.4 kernels, introductions
to 2.6, a whole new chapter on the shared memory filesystem, coverage of TLB
management, a lot more code commentary, countless other additions and
clarifications and a CD with lots of cool stuff on it. This material (although
now dated and lacking in comparison to the book) will remain available
although I obviously encourge you to buy the book from your favourite book
store :-) . As the book is under the Bruce Perens Open Book Series, it will
be available 90 days after appearing on the book shelves which means it
is not available right now. When it is available, it will be downloadable
from http://www.phptr.com/perens
so check there for more information.
To be fully clear, this webpage is not the actual book.
Next: 10.1 Managing the PKMap
Up: understand-html
Previous: 9.7 Interfacing with the
  Contents
  Index
10. High Memory Management
The kernel may only directly address memory for which it has set up a page
table entry. In the most common case, the user/kernel address space
split of 3GiB/1GiB implies that at best only 896MiB of memory may be directly
accessed at any given time on a 32bit machine10.1 as explained in Section 5.1.
There are many high end 32 bit machines that have more than 1GiB of memory
and the inconveniently located memory cannot be simply ignored. The solution
Linux uses is to temporarily map pages from high memory into the lower page
tables. This will be discussed in Section 10.2.
High memory and IO has a related problem which must be addressed as not all
devices are able to address high memory or all the memory available to the
CPU in the case of PAE. Indeed some are limited to addresses the size of
a signed 32 bit integer or 2GiB. Asking the device to write to memory will
fail at best and possibly disrupt the kernel at worst. The solution to this
problem is to use a bounce buffer and this will be discussed
in Section 10.4.
This chapter begins with a brief description of how the Persistent
Kernel Map (PKMap) address space is managed before talking about how pages
are mapped and unmapped from high memory. The subsequent section will deal
with the case where the mapping must be atomic before discussing bounce
buffers in depth. Finally we will talk about how emergency pools are used
for when memory is very tight.
Footnotes
- ... machine10.1
- On 64 bit hardware,
this is not really an issue as there is more than enough virtual address
space. It is highly unlikely there will be machines running 2.4 kernels
with more than terabytes of RAM.
Subsections
Next: 10.1 Managing the PKMap
Up: understand-html
Previous: 9.7 Interfacing with the
  Contents
  Index
Mel
2004-02-15