Skip to main content
1 of 2
Marcus Müller
  • 51.5k
  • 4
  • 79
  • 121

Assuming that the address space division is 1/3 gb (1gb for the kernel and 3gb for the process).

But that's not the case. There's no static address space division like that on a machine that can run Linux – quite the contrary, the virtual address spaces that processes and that the kernel uses can be (relatively) arbitrary.

Notice that I said "virtual address spaces", plural: different processes and the kernel all have a different "view" on physical address space, which itself isn't linear. So, I'm not sure where that boundary would come from.

What happens if the kernel needs to use more than 1gb?

Allocate more than 1 GB.

At boot time, if there is no process, how is the kernel mapped?

At boot time, it's the kernel that enables (depending on the CPU architecture you're using) memory protection, and starts mapping its own memory space. It actively randomizes that mapping – KASLR.

I'm not sure why you think anything is special about 1 GB. It isn't! The kernel maps its memory as needed.

Are you perhaps referring to a limitation of the nearly-died out 32 bit i386 architecture? In earlier versions of Linux, there was, in the kernel address space, a constant mapping below PAGE_OFFSET (which IIRC was indeed at 1 GB?), above which userspace memory spaces might have been "mapped in". I don't think that's true anymore even on x86 (you should be able to redefine PAGE_OFFSET and compile), but it's definitely not true on x86_64, aarch64, riscv64…

Marcus Müller
  • 51.5k
  • 4
  • 79
  • 121