Linux – Running out of LowMem with Ubuntu PAE Kernel and 32GB of RAM

kernellinuxmemorypaeUbuntu

I'm running a Java data import process on a 32-bit Ubuntu 10 PAE kernel machine. After running the process for a while, the oom-killer zaps my Java process. After some Googling and digging through docs, it looks like the system is running out of LowMem. I started the process for the third time and am watching free -lm show me Low: 464 386 77 with the free value (77MB) slowly decreasing.

Why am I running out of lowmem and how do I increase it?

Some details:

$ cat /proc/sys/vm/lowmem_reserve_ratio
256     256      32
$ free -lm
             total       used       free     shared    buffers     cached
Mem:         32086      24611       7475          0          0      24012
Low:           464        407         57
High:        31621      24204       7417
-/+ buffers/cache:        598      31487
Swap:         2047          0       2047

Best Answer

The problem is that a lot of the kernel data structures such as the page descriptors (one struct for every 4KB page in the system) need to be in low memory. So as the total memory in the machine goes up, more and more low memory is also needed, and eventually low memory becomes a very scarce resource.

IIRC the usual rule of thumb is that 16 GB total is about the upper sane limit for a 32-bit kernel. There's not very much you can do about it.

You can try to boot with less memory (mem= command line parameter to the kernel). But the real solution is to switch to a 64-bit kernel.