amtoaer

晓风残月

叹息似的渺茫,你仍要保存着那真!
github
x
telegram
steam
nintendo switch
email

Solution to high CPU usage caused by wslg in wsl2

Since upgrading to Windows 11, I have often encountered the problem of the fan spinning loudly and the tray flashing when using WSL. However, it was not very noticeable in the noisy environment of my school dormitory, so I didn't pay much attention to it.

Recently, when I returned home during the vacation, I had nothing to do and decided to brush up on my coding skills. To my surprise, the fan noise was so loud. So I tried to search for a solution.

Reproduction#

This issue is easy to reproduce on my computer. Just run WSL, even if it's idle, the fan will spin loudly and the CPU usage will be high.

Investigation#

I opened the Task Manager to check the CPU usage and found two processes with high CPU usage:

  1. vmmem
  2. Windows Audio Device Graph Isolation

The first one is a Windows virtual machine process, so I focused on it.

Since this issue only appeared after upgrading to Windows 11, I initially suspected that it was related to WSLg introduced in Windows 11.

Based on the above analysis, I used a search engine to query "wslg vmmem high cpu usage" and found microsoft/WSL#6982 and microsoft/wslg#443.

Conclusion#

Based on the discussions and analysis in the above issues, this problem is caused by the crash of the WSLg weston clipboard and may be related to changes in multi-monitor settings. Currently, there are three solutions:

  1. A magic shortcut key for temporary solution: Win+Ctrl+Shift+B (it essentially resets the graphics driver).

  2. If you don't rely on WSLg, you can create <USERPROFILE>\.wslconfig and write the following content to disable WSLg:

    [wsl2]
    guiApplications=false
    
  3. The fix is already included in the preview version here. You can manually update to the preview version: wslg Pre-release 1.0.28

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.