Linux Kernel – Preloading the OOM Killer

kernellinuxmemory

I don't have any swap partition/file on my machine, and only 2GB of RAM.

Sometimes it happens that the memory gets saturated by some process (Xorg+browser+compiler+…) and the system hangs indefinitely, and the only way to restart it (other than hard reset) is with SysRq.

I understood that the Out Of Memory Killer won't help me because when the memory is completely full, kernel cannot allocate the OOM Killer itself.

Is there any way to preload the OOM Killer, so that it can actually work when memory is completely full?
Or is it possible to tweak the kernel so that OOM Killer gets activated when my ram is full at ${TOTAL_RAM} - 10MB?

Best Answer

I'm fairly sure that the kernel reserves some memory for itself, i.e. for launching the oom_killer.

(What use would a oom_killer be if it fails to load due to lack of memory?)