The standard RedHat recommendation 204 is to keep min_free_kbytes at 1-3% of the total memory on the system, with Aerospike advising to keep at least 1.1GB, even if that is above the official recommended total memory percentage.
On a system with over 37GB of total RAM, you should leave no more than 3% of spare memory to min_free_kbytes in order to avoid the kernel spending too much time unnecessarily reclaiming memory. This would equal anywhere between 1.1GB and 3% of total RAM on such systems.
Setting min_free_kbytes too low prevents the system from reclaiming memory. This can result in system hangs and OOM-killing multiple processes.
However, setting min_free_kbytes too high (for example, to 5–10% of total system memory) causes the system to enter an out-of-memory state immediately, resulting in the system spending too much time reclaiming memory.
Setting min_free_kbytes too high will cause system hangs, especially in i386 arch, using less than 5% of total memory can avoid it, so choose %5 of free memory or 2% of total memory. Thanks Shuang pointed out it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
* Description: * * The case is designed to test min_free_kbytes tunable. * * The tune is used to control free memory, and system always * reserve min_free_kbytes memory at least. * * Since the tune is not too large or too little, which will * lead to the system hang, so I choose two cases, and test them * on all overcommit_memory policy, at the same time, compare * the current free memory with the tunable value repeatedly.
* a) default min_free_kbytes with all overcommit memory policy * b) 2x default value with all overcommit memory policy * c) 5% of MemFree or %2 MemTotal with all overcommit memory policy
This is used to force the Linux VM to keep a minimum number of kilobytes free. The VM uses this number to compute a watermark[WMARK_MIN] value for each lowmem zone in the system. Each lowmem zone gets a number of reserved free pages based proportionally on its size.
Some minimal amount of memory is needed to satisfy PF_MEMALLOC allocations; if you set this to lower than 1024KB, your system will become subtly broken, and prone to deadlock under high loads.
Setting this too high will OOM your machine instantly.