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
Windows 10 guest not seeing free memory with balloon driver #568
Comments
@Ristovski Please provide more info about the issue: which hypervisor you use: qemu (which?) or something different, how do you inflate the balloon, what is exactly the sequence of operations to reproduce the problem. |
@ybendito I use I don't explicitly balloon it myself, I set the memory settings in and also have the following entry in the xml:
From my understanding, the intended behavior would be that the Windows guest would think the memory is free, and the ballooning driver would release/claim more transparently, as its being used. I am also able to manually balloon the memory with something like Whole xml: Click to expand
|
For reference, this is how it looks like right after the guest boots up: Using the guest like this as-is gives terrible performance, since the cache will quickly fill up and get paged to disk (notice the amount of memory available, and the amount cached) From my understanding, the guest balloon driver should be able to automatically request more memory from the host, but this is not the case (or is happening at 100% RAM usage, in which case its completely useless due to the aforementioned issue with caches and paging) |
IMO, completely correct behavior of the balloon. The guest is configured to run with [max of] 3.2G memory and use 1G. So the rest of memory is in the inflated balloon. When you disable the balloon driver the memory becomes free. When the balloon is enabled you can change the current allocation to be = max, this will deflate the balloon. |
@ybendito I assumed the ballooning was dynamic by default, but now I see this is not the case. Closing as invalid. |
I have the very same observation on that behaviour. And although I have not much insight on the technical details behind the scenes, I have a hard time to understand how this could be expected behaviour... Rather I would expect the same behaviour than with Hyper-V dynamic memory: From the host you tell the guest the range of memory it is allowed to use. The guest starts with the minimum and leaves the rest to the host. Later on, when the guest starts using more and more memory (e.g. opening some programs), in the same way the guest's used memory increases, the host's free memory decreases. And when you over provisioned the guest's memory, the host would even start swapping out the memory to the hard disk. I thought the memory balloon tries to implement just this. Am I missing out some conceptual details? |
@linuzer From what I was able to gather, I assume Windows does not support memory hot add/remove while Linux does. And indeed virtio memory ballooning with a Linux guest works as intended. Meanwhile with Windows guests the following happens:
Now if you were to update the virtio ballooning parameters at runtime, this would simply cause the virtio balloon driver to free or reserve additional memory. I am not sure how Hyper-V does it (perhaps Windows detects its running under Hyper-V and enables different memory management?), but I assume this is the only alternative. |
OH, I see. Thanks a lot for the explanation! So in other words, the balloon-driver does it the linux-way, which works perfect in a linux guest, but on a Windows guest it just provokes the above results. Of course, changing the parameters on-the-fly could somehow improve the situation. Would it be right to asume, that the Windows-part of the balloon-driver just needs to be adopted to the Hyper-V-way/Windows-way of memory management to get the same behaviour under Windows? |
Doing it the same way as Hyper-V does can be a problem. |
@vrozenfe In the while, MmAddPhysicalMemory has been documented https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-wdm-mmaddphysicalmemory |
@ohault Best, |
@Ristovski windows vm only use 1 GB ram,and I allocate it for 3 GB ram, why rss display 3 GB? |
EDIT: For future reference, virtio memory ballooning is not dynamic by default. Meaning, if you want the guest to request more memory from the hypervisor based on something like memory pressure, that would be up to you to set up (a script talking to a virto channel should work).
Rest of issue is invalid since it's working as currently intended.
Enabling the balloon driver works as expected - host memory gets released, but this also causes the Windows 10 guest to think that the released memory is in-use and reports upwards of 99% RAM usage.
Here is a screenshot of enabling and disabling the
VirtIO Balloon Driver
device in Device Manager.The memory on the host side does indeed get released and reclaimed as usual, but on the guest side, enabling the driver causes Windows to think that the memory is in-use (thus the peak in the memory graph).
The main issue is that this causes Windows to drop caches to disk, which causes degraded performance, and I assume it also will never get more memory ballooned.
The text was updated successfully, but these errors were encountered: