Here is my current setting:
vm.overcommit_ratio = 50 (default)
vm.overcommit_memory = 2And Current Memory Usage:
[localhost~]$ free -g total used free shared buffers cached
Mem: 47 46 0 0 0 45
-/+ buffers/cache: 1 45
Swap: 47 0 47As per the documentation what I understood is:
vm.overcommit_memory = 2 will not allow to overcommit memory than 50 % of RAM (as vm.overcommit_ratio is 50) but still I can see that current memory usage is 46 GB out of 47 GB.
Did I misunderstand something?
01 Answer
From your documentation link:
2 — The kernel fails requests for memory that add up to all of swap plus the percent of physical RAM specified in /proc/sys/vm/overcommit_ratio
In your case, you have 47gB RAM, 47gB swap and overcommit_ratio is 50 so a the total memory used can go up to 47+47*.5=70.5gB.
Your currently used memory is 46gB in RAM and 0gB in swap so a total of 46gB which is still under the limit.