[Gllug] 4G Memory Restriction

Christian Smith csmith at micromuse.com
Mon Apr 10 16:15:49 UTC 2006


On Mon, 10 Apr 2006, Daniel P. Berrange wrote:

>
>  - RHEL-3 Hugemem, was PAE enabled, but also switched to a 4 GB/ 4 GB
>    kernel / userspace memory model split. Now remember even with
>    PAE, x86 can only have 4 GB mapped at any time. So with the 4-4
>    split, every time you do a system call the pagetables must be
>    switched. Since the kernel now has its own 4 GB to play with,
>    you can install > 16 GB of RAM and still operate without risk
>    of OOM
>
>So, in summary once with PAE mode, you have an effective 40 bit address
>space so any kernel supporting PAE can *theoretically* support > 4 GB.
>Due to the Liunux address space model, however, you can be *practically*
>limited to a smaller amount, predicated on your ability to maintain the
>page table structure. You can find more tech details on the LKML message
>where Ingo posted the original 4/4 GB patches
>
>  http://lwn.net/Articles/39283/


This 4G/4G is basically how many other kernels, such as Solaris on SPARCv9
and HP-UX, split the kernel from the user process. It basically runs the
kernel in it's own seperate address space, so that switching to the kernel
is effectively a context switch, and basically slowing everything down.

Other processors such as MIPS, SPARC and PA-RISC get round this by having
the address space ID as part of the virtual address tag in the TLB, thus
switching address spaces does not require a full TLB flush like it does on
the x86.

That said, Linux is very naive in how it handles physical memory, using a
very simple model of 1:1 mappings instead of using paged kernel virtual
memory. Contrast with Solaris on x86, which (certainly with v7) only
needed 256MB of kernel address space, and allowed 3.75GB of user address
space. Any physical memory that required updates from the kernel are
managed using temporary mappings. But most kernel memory management is
paging in and out from files, and can be done straight to the physical
page without being mapped to kernel space, so the only kernel mappings
required are IO to/from devices and non-mmap()'ed file IO.

I find VM an interesting subject. Linux is not a particular good example
of a clean VM design, possibly because it was based on the i386 paging
model and not abstracted out very cleanly. The BSD or SysV VM model is
much cleaner, and don't generally require the big memory hacks Linux has
done in 2.4 and 2.6.


>
>Regards,
>Dan.
>

-- 
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list