WSL: fix Vmmem high CPU usage

Last time, when I wrote about using a trackpad instead of a mouse, I mentioned also about my migration from MacOS to Windows. Right now, I work with Windows and use WSL (Windows Subsystem for Linux) every day. It’s a great tool which I will describe in future posts, but today just want to share a quick info – sometimes when we use WSL we can observe high CPU usage by Vmmem process. Without a clear reason, without any CPU-intensive operations inside our WSL. In such case you can open a WSL terminal, run top or htop command and check CPU usage – probably it is caused by init process inside your Linux distribution.

The problem is known and Microsoft works to resolve it, but right now we have to use one of possible solutions. First one is just to restart WSL distribution – it will help and after reopen, Vmmem CPU usage should be normal. You can restart WSL using this simple command from PowerShell / Windows Terminal:

wsl --shutdown

Yes, a little strange, because it says “shutdown”, and in reality, it will restart your WSL. This should resolve issue, but it can happen again – many users, including me, report that high CPU usage occurs after system sleep. I had similar issues with Docker for Desktop on Mac, it slowed down dramatically after sleep and wake up. The only solution to fix that was restarting Docker.

With WSL we can use small trick – disable Windows Subsystem for Linux GUI. Many users report, that the issue is caused by that module, even if we do not use any GUI apps from Linux inside our WSL. I do not use them, so decided to disable WSLg. The thing is more interesting – WSLg is not available in current stable Windows 10 revision (19043), but probably already implemented and can cause some issues. To disable WSLg we have to edit .wslconfig file. In default configuration, it isn’t present, so you have to create it manually in: systemdrive:/Users/your-username/.wslconfig(yes, with the dot in the beginning). Then add to that file simple configuration:


Save file and restart the computer or just restart WSL using command above. It should resolve that issue and after they will fix it in WSL core, it will be possible to unlock GUI apps. By the way, you can configure different WSL settings in that file like maximum memory usage limit – just check official Microsoft documentation.