Source: /cirosantilli/x86-paging/kernel-vs-process-memory-layout

= Kernel vs process memory layout

The Linux Kernel reserves two zones of virtual memory:
* one for kernel memory
* one for programs

The exact split is configured by `CONFIG_VMSPLIT_...`. By default:
* on 32-bit:
  * the bottom 3/4 is program space: `00000000` to `BFFFFFFF`
  * the top 1/4 is kernel memory: `C0000000` to `FFFFFFFF`, like this:
    ``
    ------------------ FFFFFFFF
    Kernel
    ------------------ C0000000
    ------------------ BFFFFFFF


    Process


    ------------------ 00000000
    ``
* on 64-bit: currently only 48-bits are actually used, split into two equally sized disjoint spaces. The Linux kernel just assigns:
  * the bottom part to processes `00000000 00000000` to `008FFFFF FFFFFFFF`
  * the top part to the kernel: `FFFF8000 00000000` to `FFFFFFFF FFFFFFFF`, like this:

    ``
    ------------------ FFFFFFFF
    Kernel
    ------------------ C0000000


    (not addressable)


    ------------------ BFFFFFFF
    Process
    ------------------ 00000000
    ``

Kernel memory https://stackoverflow.com/questions/18953598/is-it-true-that-whole-system-space-address-space-in-linux-does-not-use-demand-pa[is also paged].

In previous versions, https://stackoverflow.com/questions/1658757/linux-3-1-virtual-address-split[the paging was continuous, but with HIGHMEM this changed].

There is no clear physical memory split: https://stackoverflow.com/questions/30471742/physical-memory-userspace-kernel-split-on-linux-x86-64