Linux kernel memory management

oldhat

Executive Member
Joined
Jun 27, 2007
Messages
5,948
Reaction score
956
Location
Gqeberha
Is it safe to change these values permanently?

vm.overcommit_memory = 2
vm.overcommit_ratio = 100

My distro's defaults are:

vm.overcommit_memory = 0
vm.overcommit_ratio = 50

Seems to work fine when used temporarily. Just not sure if it may cause issues in the future, if set permanently.
 
Someone may find this useful. After doing some research, I have decided it is best NOT to make these changes permanent. The default values are better for normal multitasking use.

Firstly, here's what vm.overcommit_memory settings do:

0: The Linux kernel is free to overcommit memory. This also enables Out Of Memory(OOM) Killer.
1: The Linux kernel will always overcommit memory.
2: The Linux kernel will not overcommit memory.

While vm.overcommit_ratio is a percentage.

The kernel then uses the following formula to calculate RAM usage:

Memory Allocation Limit = RAM * (Overcommit Ratio / 100) + Swap Space

This means with vm.overcommit_ratio = 50, half the RAM gets used initially. Therafter, the kernel is free to use more as vm.overcommit_memory = 0. The OOM Killer is then used to kill processes if it detects a situation where all available memory is about to be used.

The reason I was experimenting with these values is due to Cities: Skylines crashing on my system. I discovered that the Linux native port loads ALL available data on startup. The base game works with my 16GB RAM + 16GB swap partition, but adding dlc content, etc. and RAM requirements can exceed 60GB!

My solution was to create & activate an additional 32GB swap file, and changing those 2 settings to get the game to work.
 
Top
Sign up to the MyBroadband newsletter
X