Highmem

From LinuxMIPS
Revision as of 09:48, 5 November 2004 by Ralf (Talk | contribs)

Jump to: navigation, search

Overview

Highmem is a method that increases the usable address space. Originally developed for Intel i386 where it enables the use of more than approx. 970MB of memory. Most of the code is portable to other architectures.

Memory Managment on Linux/MIPS

32-bit Linux/MIPS kernels assume the entire low memory to be accessible through KSEG0 which limits lowmem to at most 512MB. Typical MIPS systems reserve part of that address space for other uses so a lowmem limit of 256MB is a common value. Memory beyond that can be used by 64-bit kernels or 32-bit kernels with highmem support enabled.

Problems

Linux allocates a large array named mem_map[] in lowmem. On 32-bit kernels it contains one 64-byte entry per page of memory. Entries are allocated even for reserved memory ranges. This consumption of lowmem means memory pressure on lowmem will rise with the amount of highmem. In practice at most a ratio of 1:4 to 1:8 has been found to perform well.

Highmem is accessed through temporary mappings. Creation and teardown of such mappings are are not for free and mappings are only permitted to exist for a short time. This means any kernel software using highmem needs to be written with special care or performance and stability of the entire system are at stake.

Alternatives

64-bit kernels use XKPHYS to access their lowmem. Due to the size of XKPHYS the entire physical memory is directly accessible so highmem isn't needed with 64-bit kernels. 64-bit kernels have somewhat larger code and data resulting in a slight slowdown. This however is by far preferable over the impact of highmem.