-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WSL 2 only using half the cores of the host machine #4137
Comments
@prenaux - Do your machine have 2 CPUs? We have some changes in progress for configuring various properties of the WSL2 lightweight VM. These are not traditional VM's. If it isn't running, it doesn't exist. They are created on-the-fly so they do not appear in Hyper-V manager. |
I'm testing WSL2 on a Ryzen7 1700 CPU, single socket. I build the same java project from the command line, on the same machine. Using an HyperV VM where I allocated 15 of the 16 threads to the VM, and then in WSL2. WSL2 never uses more than 50% of the CPU, the HyperV VM uses the 15threads, so close to 100% CPU usage. I doubt it's a contention issue on WSL2 - although I suppose it possible - the reason I say that is because I noticed the same issue the first time I setup the HyperV VM, and I had to go change the default configuration. Maybe the default uses the core count instead of the thread count, or something of the sort, the usage profile is really stuck at 50%, if it was contention I wouldnt expect it to stay so close to 50% usage for the 10-20mins WSL2 build... I use Process Explorer to look at the graph of the CPU usage. |
Looks like I'm not properly calculating how many cores to give to the WSL2 lightweight VM. Working on a fix now. |
In specific setups? I only ask because I've got a (lowly?) i7-6700K and my bog-typical |
@therealkenc - Yes, it seems only configs are affected. |
Figured it out, the kernel is being built to only allow 8, I'll fix this.
|
@benhillis Please let us know when the update is live, I'll try it out. |
@benhillis Not sure what your fix is (increase cap or remove it). I do have some questions:
Trying to use a dual SkyLake Xeon (112 total logical processors) with WSL 2 and am currently severely constrained by the 8 proc limit. |
@g0blue You can compile the latest kernel to try it out. Following the steps from #4203 but getting the sources from here instead: https://github.com/microsoft/WSL2-Linux-Kernel. |
Thanks @onomatopellan! This worked great. It seems that it still only uses 1 processor group, so even though the max cores is bumped to 256, you'll never actually use more than 64. My dual SkyLake is now limited to 1 socket (56 logical processors). Much better than 8, but less than what can be used with WSL 1. |
@g0blue - Do you happen to know how many processors GetSystemInfo returns for your machine? I'm assuming 56. |
Yes, 56. Relevant links: |
@benhillis any update on this? I just updated the Windows machine and reinstalled WSL2 from scratch and its still only using 8 cores, is the only option really to recompile the kernel somehow? If so how do you go about doing that? |
Should already be fixed. What version are you running? |
Or specifically does your system have multiple processor groups? |
@benhillis The test is on a Ryzen7 1700, so that's a single processor group (8c/16t). Do I need to re-download the Ubuntu appx? I've reused the one I downloaded a while back (because the Microsoft Store is broken again and refused to dl it...) I also have a Threadripper 2950, are the 2 NUMA (unit/core?) 2 processor groups? |
@prenaux - No you do not need to redownload any apps. Can you share the output of the following commands? uname -r |
I'm having the same issue on a Threadripper 2950X. uname -r zcat /proc/config.gz | grep -i NR_CPU dmesg | grep 'Command line' |
@bjarnirafn - you are running an old Insider version with the # of cores capped at 8. You should upgrade to a new build. |
@benhillis I can confirm that the issue is fixed - I spent some time today to unstuck Windows Updates (reset caches... etc) and it updated to 19002. So I probably wasn't running the latest build. Tested on a Ryzen 1700. |
@benhillis I am having a similar issue. I have a multi socket system using two Intel Xeon E5-2699 v3 CPUs. In windows 10 it reports 2 Sockets, 36 cores and 72 logical processors. Those commands in WSL 2 listed above give, 4.19.84-microsoft-standard If I type in lscpu | grep -E '^Thread|^Core|^Socket|^CPU(' it gives So it appears that only one socket is being recognized. What can I do to make sure that it recognizes both CPUs? Do I need to build a kernal with NUMA support like mentioned here? (#5025 (comment)) Let me know if I need to open a different ticket somewhere else. Thank you. |
I also have the same issue with AMD threadripper. It detects the CPU as a 2 socket system but only uses one of the sockets. Is there anyway to fix it? |
It is worth opening new issue if people still aren't seeing all their cores on two-socket rigs, because the resolution for this issue ( |
So, I went to open a new issue, and I found #3314 - which is exactly the issue that needs to be opened and was closed as a duplicate of #1115 by you. To be clear, the issue has nothing directly to do with number of sockets, it's purely an issue with multiple processor groups in Windows. Should I file a bug (feature?) requesting support for multiple processor groups? Will this also get closed as a duplicate of #1115? |
OK, looking at the date for #3314 I see that this was still WSL 1. So, I suppose open a new feature explicitly asking for WSL 2 support for multiple processor groups? |
To be clear the issue is "WSL 2 is only using up to 50% of the CPUs on my 8c/16t [Ryzen 1700] machine", which has been fixinbound (really fixedininsiderbuilds) since June 2019 (and confirmed by the OP in October).
[edit] I see now you are dual socket too. Same question with same answer as Greg. |
I would suggest a new issue for multi processor groups. I am already looking into this, AMD brought this to my attention as well. |
@benhillis @therealkenc is this fixed or is there some issue to subscribe somewhere? Thanks! |
@sanastasiou , Did you find any issue posted? because even when I gave up on WSL 2 and moved back to hyper V, the issue still persists. :( |
No one has submitted a new issue for the multi processor groups scenario AFAIK. Doing one is somewhat academic since the devs are aware of the limitation, but it could act as a "like" target. |
@therealkenc anything against re-opening this issue? Or simply referencing it from a new issue? |
@sanastasiou @therealkenc , I opened a new issue #5423 for the AMD cpu issue. |
hi @benhillis, |
lscpu
I have 2 sockets (2 cpus), each with 14 cores and 28 threads, now I can recognize all cores well in wsl2, but numa can't recognize 2. This also caused all numa2 cores to be identified as numa1 hyperthreads. This has a significant performance impact. htop |
The same issue still persists with WSL2 in 2024. See the attached image above. I was running multiple ML model with Pytorch and Tensorflow. lscpu
I was thinking of editing From WSL2, |
Hi Unfortunately, there is no development on this issue. There are constant requests on this issue, but they are marked as "duplicate requests" and directed to old notifications. Is there any development? Actually, there are multiple expectations regarding this NUMA issue; It would be really great if such a development could be made. Thank you in advance for your efforts. |
Thanks for your patience on this - we have identified a fix for this and will be releasing it as an update soon. |
WSL 2 is only using up to 50% of the CPUs on my 8c/16t machine.
I currently use an Hyper-V Ubuntu VM and had the same issue initially, as that was the default setting after creating the VM. With Hyper-V I can use the Hyper-V manager to allocate more cores, but I dont see any way of doing that with WSL2.
If WSL2 are Hyper-V VM it would be convenient to be able to configure them in the Hyper-V manager.
Is there anyway to setup the resource allocation of the WSL2 VM's?
The text was updated successfully, but these errors were encountered: