I have been experiencing issues with the process `kcompacd0` consuming 100% of resources periodically, stalling the VM and making it unusable for minutes at a time.
My host is Ubuntu 20.04.4 on a fully loaded dual socket HP Z840. Workstation Pro version: 16.2.1 build-18811642 .
I depend on using VMWare workstation to run my business and cannot have these types of performance issues. I never noticed this problem prior to version 16.0.
At version 16.1, I was able to mitigate this by setting `vm.compaction_proactiveness=0` in the VM's vmx file, however it appears that with 16.2, this setting is now ignored.
Here is a related thread on unix.StackExchange .
I'm almost to the point of abandoning Workstation again and switching back to Virtual Box.
[+ screenshot] Take note of Time for kcompacd0 process. When `kcompacd0` in consuming 100% of resources, I often see `vmware-vmx` taking 400%. Although my machine has dual xeon processors, the host still lags significantly!
From this link - https://gist.github.com/2E0PGS/2560d054819843d1e6da76ae57378989 - I found that editing /etc/sysctl.conf (different on Arch-based, but the same principle) worked for me:
# Fix problem where vmware battles with kcompactd0.
vm.compaction_proactiveness=0
Reboot required, of course.
Hi,
What ajgringo619 says, see also this thread for context:
https://communities.vmware.com/t5/VMware-Workstation-Player/Over-CPU-usage-in-idle/m-p/2878569
and the reply from akornilov82
--
Wil
Looks like reboot was the step needed. I'm not sure I did a reboot after I updated VMware. After reboot, I was prompted to recompile kernel module for vmware.
I will continue to monitor this but it appears to be fixed.
[Update] This issue has not come back. It appears that the reboot after updating and the vmx setting did the trick.
Comfirm that win10 guest freezes and kcompactd0 kicks in with compaction_proactiveness=0.
Tested with:
Ubuntu 22.04 kernel 5.15.35 / 5.16.20
VMWare 16.2.3 / 16.2.0 / 16.1.2
Win10 Guest, 4GB / 6GB memory allocated
This issue is back with force. My Ubuntu is fully updated and VMware workstation version is 16.2.4 build-20089737. VM takes all cores assigned at 100% (600% on top) and kcompacd0 is taking 100%.
The only fix I found is to reboot my host OS 😞
Any help would be appreciated.
I updated two Systems (Workstation and Laptop) from Ubuntu 20.04 to Ubuntu 22.04 LTS.
As VMware Workstation is not running on Ubuntu 20.04 I updated to VMware® Workstation 16 Pro 16.2.4 build-20089737.
VMware Guests with Windows 10 became complete unusable. Take into account that both systems worked fine with Ubuntu 20.04 and VMWare 15!
I played in a backup of Laptop to Ubuntu 20.04 and installed VMware Workstation 16.2.4
One Windows 10 Guest is on an external SSD. So I started the same guest on both systems. Result:
Ubuntu 20.04 & VMware 16 is fine. Guest does not freeze
Ubuntu 22.04 & WMware 16 is unusable. Guest freezes regularly and Host is on 100% for kcompactd0.
[Update] I had my windohs VM open for quite a while with no issues (I was watching with top) but once I loaded a big project with Visual Studio, it went nuts. Therefore, it seems that disk or cpu load seems to be a factor in this bug.
Same problem for me.
I tried all the kernel hacks without success.
echo 0 > /proc/sys/vm/compaction_proactiveness
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo 1 > /proc/sys/vm/swappiness
Is there still no solution for this problem?
Linux pingu3 5.15.0-48-generic #54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
It seems
vm.compaction_proactiveness = 0
works properly till Kernel 5.13. It doesn't work anymore from Kernel 5.15.
- Ubuntu 22.04 LTS use v5.15 /5.17 as default
- Ubuntu 20.04.4 LTS use v5.13
- Ubuntu 20.04.5 LTS use v5.15 <-- Released 1/9/2022
Is this issues something that VMware will fix on VMware Workstation 16? If not, I'm out. I will not be buying any more new licenses of VMware products. Tired of forking out big $ for new licenses after older linux versions break.
Hello, I had a simular problem and resovled by executing following commands, before starting a Windows VMware instance.
sudo sync
sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
sudo sh -c 'echo 1 > /proc/sys/vm/compact_memory'
I heard that the problem is due to a memory fragmentation of a host Linux OS and these commands defrag your memory.
Another thing that may trigger this problem is when "Accelerate 3D Graphics" is enabled. Therefore, if not needed, turn this off.
@pokemoguYour solution hit the nail on the head. It will still come back after a couple of days but suspending VMs, shutting down vmware and following your suggestions gets it working again. At least its better than having to bounce the host.
Cheers,
- Tim
I've created a gist on Github with a desktop file to replace the launcher for workstation with an updated version that takes care of the steps provided by @pokemogu .
The following article in unix stachexchange was posted 1year ago and in the thread the most effective measure is decribed. No one has mentioned it here so I report it here.
The measure is to add an option to GRUB, which turns on INTEL_IOMMU function.
First, edit /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on"
Second,
# update-grub
Then restart your host and you will see this problem is greatly improved.
My host is Ubuntu 20.04 on iMac mid 2011 (2core 4thread 16GByte RAM).
When Memory usage exceeded 8GByte, kcompactd0 always kicked in and it monopolized cpu resources. It continued to work and swapped in memory despite the enough memory space.
However, since intel_iommu was turned on, this problem has been greatly improved.
Still now, kcompactd0 often kicks in especially when memory usage exceeds 8GByte but it is not persistent like before.
Now I'm using original values for compaction_proactivity and swappiness, 20 and 60, respectively.
This was to complex for me, so I tried the following, all in one line:
# sudo vi /usr/local/share/applications/vmware-workstation.desktop
[Desktop Entry]
Encoding=UTF-8
Name=VMware Workstation
Comment=Run and manage virtual machines
Exec=sh -c "sudo sync; sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'; sudo sh -c 'echo 1 > /proc/sys/vm/compact_memory'; /usr/bin/vmware %U"
Terminal=false
Type=Application
Icon=vmware-workstation
StartupNotify=true
Categories=System;
MimeType=application/x-vmware-vm;application/x-vmware-team;application/x-vmware-enc-vm;x-scheme-handler/vmrc;
~
I rebooted the system and it works.
After that I increased the memory of the Windows 10 Guest to 8 GB of 10 GB, activated 3D acceleration and
... it works !!!
After upgrading to 16.2.5 my Win10 VM became unusable. Rondo85 script addition seems to have fix the problem for me.
Thanks.