Linux OOM killer (Out of memory) and NFS server optimization

last updated in Categories Linux, Troubleshooting, Tuning

OOM is short form for Out of memory. As name suggest it kills process randomly when the size of the data to be copied exceeds the size of physical memory i.e. when out of memory situation occurs OOM kills the lower priority process and frees the memory.


It is the job of the linux ‘oom killer’ to sacrifice one or more processes in order to free up memory for the system when all else fails.

Recently I fixed NFS related problem by setting vm.lower_zone_protection to 150 via sysctl facility. A reasonable value for lower_zone_protection is 150. But what is 150? It is 150 MB (approximately).

The lower_zone_protection tunable determines how aggressive the kernel is
in defending these lower zones. In simple words – I am preventing NFS eating up all memory and keeping my system stable. Remember 150MB will be reserved and not allocated to any one including applications, users, and cache.

Open your /etc/sysctl.conf and add following line (thanks to Alexander N. Spitzer for solution/hint):
# vi /etc/sysctl.conf
Append followin line:
vm.lower_zone_protection = 150
Save the change and reboot system. Mount NFS share and it will now able to create large file.

On the other hand, you can type the following command at shell prompt:
# echo 150 > /proc/sys/vm/lower_zone_protection


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

5 comment

  1. It doesn’t kill randomly! It select the “best” process to kill, as stated in the description page you linked in the page

  2. Sandro,

    OOM kills the lower priority process and frees the memory, if there are 10 process with lower priority process, OOM will select any random process from pool of 10 process. That is why I had used the word ‘random‘.

    However, the algorithm written by Linux kernel developer is quite smart to detect which process to kill. Unfortunately some time *smart algorithm* fails to work (for example my NFS Server) and it started to kill important process such as sendmail.

    That is why I had to control OOM via sysctl. Now system is stable. Correct me if I am wrong here.

    Appreciate your post.

  3. Specified lower_zone protection works for all applications? Like I have n number of applications running on host A, after adding one more application (n +1), host was stable for a week without any problem. But I got OOM killer issue after a week and started killing most of the processes one by one. To fix the issue I disabled n + 1 application and rebooted the host. Can I configure lower_zone protection to solve above problem?

  4. I’m not find variable on centos 6.X

    cat /proc/sys/vm/lower_zone_protection

    cat: /proc/sys/vm/lower_zone_protection: No such file or directory


  5. Me too, on Debian 8.
    # cat /proc/sys/vm/lower_zone_protection
    cat: /proc/sys/vm/lower_zone_protection: No such file or directory

    Running kernel: 4.4.10-1-pve

    Have a question? Post it on our forum!