VMware input lag unbearable performance solution

I ended up here looking for something else, more specifically this thread https://forum.manjaro.org/t/slow-and-lagging-system/96154 this is part of a larger issue, while exact culprit isn’t known, the performance hit comes from a combination of transparent hugepages (THP), and something regarding “vm.compaction_proactiveness” (default value is 20).
There is a MAJOR increasing of performance, going from barely usable freezing up every 30sec - 2mins, by changing the following; I’ve put the parameters via systemd:

[Unit]
Description=friends dont let friends use transparent huge pages

[Service]
Type=oneshot
ExecStart=/bin/sh -c "/usr/bin/echo never | /usr/bin/tee /sys/kernel/mm/transparent_hugepage/enabled"
ExecStart=/bin/sh -c "/usr/bin/echo never | /usr/bin/tee /sys/kernel/mm/transparent_hugepage/defrag"
ExecStart=/bin/sh -c "/usr/bin/echo 0 | /usr/bin/tee /proc/sys/vm/compaction_proactiveness"

[Install]
WantedBy=multi-user.target

Stick this file @ /etc/systemd/system/disable_thp.service

$ sudo systemctl enable disable_thp.service
sudo systemctl start disable_thp.service

Can also alternatively feed grub “transparent_hugepage=never” at boot, but still have to deal with “compaction_proactiveness”. Simple enough,
# echo 0 > /proc/sys/vm/compaction_proactiveness – must be done as root, not sudo
(Have to do this every boot if not using the systemd way)

Reboot and voila, major major performance gains. It took me months to find this solution to a pretty nasty problem, I couldn’t run a single VM smoothly prior to this, and atm have 3 VMs in the background, all buttery smooth. No more stutters, no more input lag, no cpu spikes.
I don’t think Virtualbox is affected as much, I’ve always used VMware, and a fair amount of users suffer from this, it’s not an obvious fix. Had already tried increasing resources, playing around with 3D accel, all to no avail, minor to no difference. I’ve actually decreased the resources I was giving my VMs by quite a bit and it’s still perfectly smooth.
I don’t know what the specific culprit is, but this information was gold for me, thought I’d post and share, if anyone else suffers from this issue. Performance of both Windows and Linux VMs is stunning, compared to without this tweak. It’s not JUST VMware that benefits from this, my overall system is noticeably faster, much more reliable. Sorry if this is posted in the wrong category. Happy new years to all

2 Likes