Specifications
This is the Title of the Book, eMatter Edition
Copyright © 2005 O’Reilly & Associates, Inc. All rights reserved.
416
|
Chapter 15: Memory Mapping and DMA
needed for the kernel code itself. As a result, x86-based Linux systems could work
with a maximum of a little under 1 GB of physical memory.
In response to commercial pressure to support more memory while not breaking 32-
bit application and the system’s compatibility, the processor manufacturers have
added “address extension” features to their products. The result is that, in many
cases, even 32-bit processors can address more than 4 GB of physical memory. The
limitation on how much memory can be directly mapped with logical addresses
remains, however. Only the lowest portion of memory (up to 1 or 2 GB, depending
on the hardware and the kernel configuration) has logical addresses;
*
the rest (high
memory) does not. Before accessing a specific high-memory page, the kernel must set
up an explicit virtual mapping to make that page available in the kernel’s address
space. Thus, many kernel data structures must be placed in low memory; high mem-
ory tends to be reserved for user-space process pages.
The term “high memory” can be confusing to some, especially since it has other
meanings in the PC world. So, to make things clear, we’ll define the terms here:
Low memory
Memory for which logical addresses exist in kernel space. On almost every sys-
tem you will likely encounter, all memory is low memory.
High memory
Memory for which logical addresses do not exist, because it is beyond the
address range set aside for kernel virtual addresses.
On i386 systems, the boundary between low and high memory is usually set at just
under 1 GB, although that boundary can be changed at kernel configuration time.
This boundary is not related in any way to the old 640 KB limit found on the origi-
nal PC, and its placement is not dictated by the hardware. It is, instead, a limit set by
the kernel itself as it splits the 32-bit address space between kernel and user space.
We will point out limitations on the use of high memory as we come to them in this
chapter.
The Memory Map and Struct Page
Historically, the kernel has used logical addresses to refer to pages of physical mem-
ory. The addition of high-memory support, however, has exposed an obvious prob-
lem with that approach—logical addresses are not available for high memory.
Therefore, kernel functions that deal with memory are increasingly using pointers to
struct page (defined in <linux/mm.h>) instead. This data structure is used to keep
track of just about everything the kernel needs to know about physical memory;
* The 2.6 kernel (with an added patch) can support a “4G/4G” mode on x86 hardware, which enables larger
kernel and user virtual address spaces at a mild performance cost.
,ch15.13676 Page 416 Friday, January 21, 2005 11:04 AM