Linux – High memory (user space) and highmem (kernel space)

kernellinuxmemory

Each process has 2 memory area: User space (high memory) and kernel space (low memmory). In the kernel space, are the first 896 MB used for mapping kernel code (not fully 1 GB)? This means, when a user -space application performs a system call or anything related to the kernel, the kernel will refer to kernel space for the system call to execute, is it?

The reserved 128MB in kernel space (for high memory (user space) access), is it all the references of user-space memory area? So, a kernel process can access any user space by refer to this area, is this true?

That's why this area is called highmem in kernel space, isn't it?

Best Answer

"High memory" and "low memory" do not apply to the virtual address space of processes, it's about physical memory instead.

In the process' virtual address space, the user space occupies the first 3GB, and the kernel space the fourth GB of this linear address space.

The first 896MB of the kernel space (not only kernel code, but its data also) is "directly" mapped to the first 896 MB of the physical memory. It is "direct" in the sense that there's always an offset of 0xc0000000 between any linear address of this 896MB part of the virtual kernel space and its corresponding address in physical memory (note however that the MMU is enabled and that page table entries are actually used for this).

The last 128MB part of the virtual kernel space is where are mapped some pieces of the physical "high memory" (> 896MB) : thus it can only map no more than 128MB of "high memory" at a time.

Reference: "Understanding the Linux Kernel", third edition - sections "8.1.3. Memory Zones" and "8.1.6. Kernel Mappings of High-Memory Page Frames".

Related Question