How Linux kernel decide to which memory zone to use?

linux, linux-kernel, memory, memory-management

Solution

These memory zones are defined only for the 32 bit systems and not in the 64 bit.

Rememember these are the kernel accessible `main memory` we are talking about. In a `32 bit` (4GB) system, the split between the kernel and the user space is `1:3`. Meaning kernel can access 1GB and the user space 3GB. The kernel's 1GB is split as follows:

Zone_DMA (0-16MB): Permanently mapped into the kernel address space. For compatibility reasons for older ISA devices that can address only the lower 16MB of main memory.

Zone_Normal (16MB-896MB): Permanently mapped into the kernel address space. Many kernel operations can only take place using `ZONE_NORMAL` so it is the most performance critical zone and is the memory mostly allocated by the kernel.

ZONE_HIGH_MEM (896MB-above): not permanently mapped into the kernel's address space. Kernel can access entire 4GB main memory. kernel's 1GB through `Zone_DMA` & `Zone_Normal` and user's 3GB through `ZONE_HIGH_MEM`. With Intel's `Physical Address Extension (PAE)`, one gets 4 extra bits to address the main memory resulting in 36 bits, a total of 64GB of memory that can be accessed. The delta address space (36 bit address - 32 bit address) is where `ZONE_HIGH_MEM` is used to map to the user accessed main memory (ie between 2GB - 4GB).

Read more:

http://www.quora.com/Linux-Kernel/Why-is-there-ZONE_HIGHMEM-in-the-x86-32-Linux-kernel-but-not-in-the-x86-64-kernel http://www.quora.com/Linux-Kernel/What-is-the-difference-between-high-memory-and-normal-memory Linux 3/1 virtual address split

Problem

When I check pagetypeinfo cat /proc/pagetypeinfo I see three types of memory zones; - DMA - DMA32 - Normal How Linux choose a memory zone to allocate a new page?

Original source

Related problems