Chapter3:MemoryManagement
1
Page tables
Page tables
Physical memory
Task switch
3
Kernel
User
Kernel
User
Figure 3-14: Connection between virtual and physical
address space on IA-32 processors.
Division of Address Space
Division of address space in a ratio of 3 : 1 is only an approximate reflection of the situation in the kernel
as the kernel address space itself is split into various sections. Figure 3-15 graphically illustrates the
situation.
high_memory VMALLOC_START VMALLOC_END
_ _PAGE_OFFSET
0xC000000
8 MiB
PKMAP_BASE
FIXADDR_START 4 GiB
Mapping of all
physical page
frames
VMALLOC
MappingsPersistentFixmaps
Figure 3-15: Division of the kernel address space on IA-32 systems.
The figure shows the structure of the pagetable entries used to manage the fourth
gigabyte of virtual address space. It indicates thepurposeof each area ofvirtual
address space, and this has nothing todo with the assignment of physical RAM.
The first section of the address space is used to map all physical pages of the system into the virtual
address space of the kernel. Because this address space begins at an offset of0xC0000000 —thefre-
quently mentioned 3 GiB — each virtual addressxcorresponds to the physical addressx− 0 xC0000000,
and is therefore a simple linear shift.
As the figure shows, thedirect mappingarea extends from0xC0000000to thehigh_memoryaddress whose
exact value I discuss shortly. As intimated in Chapter 1, there is a problem with this scheme. Because the
virtual address space of the kernel comprises only 1 GiB, a maximum of 1 GiB of RAM memory can be
mapped. The fact that the maximum memory configuration on IA-32 systems (without PAE) can be up
to 4 GiB raises the question of what to do with the remaining memory.
Here’s the bad news. The kernel cannot map the whole of physical memory at once if it is larger
than 896 MiB.^13 This value is even less than the previously stated maximum limit of 1 GiB because
(^13) It would also be possible to get rid of the split completely by introducingtwo4 GiB address spaces, one for the kernel and one for
each userspace program. However, context switches between kernel and user mode are more costly in this case.