VMware on Linux host causes regular freezes

performancevmware

When running a virtual machine in VMware (Ubuntu 16.04 host), both the guest system (Windows 10 at the moment) and the host system regularly become unresponsive for several seconds, e.g. when starting Atom or Visual Studio in the guest VM.

RAM usage reports look normal (16 GB total, 6.5 GB used by the VM as “shared memory”, some GB free), but while the system is unresponsive, IO tasks are either suspended or very slow, for example copy/paste of text takes several seconds.

Changing settings (virtualisation settings, VM’s RAM, …) in VMware does not have any effect.

Best Answer

The solution is to disable khugepaged defragmenting:

echo never | sudo tee /sys/kernel/mm/transparent_hugepage/defrag
echo 0 | sudo tee /sys/kernel/mm/transparent_hugepage/khugepaged/defrag

See this answer from the question Arch Linux becomes unresponsive from khugepaged.

Also, it is probably a good idea to limit the amount of RAM which VMware can use for running VMs to reserve some for the host system (Edit > Preferences).

VMware settings for reserved memory


Note: I am re-posting this answer under this question because the answer is very hard to find – it literally took me years.

Related Question