[PVE 9.0.6] Judging Normal/Abnormal "Host Memory Usage" vs In-VM Memory Usage for Ubuntu VM with Ballooning Disabled?

Sep 1, 2022
475
180
48
41
Hello,

Upfront, it may be that I'm seeing an odd output because I've disabled the ballooning device so I can do PCIe passthrough with this VM, but I wanted a quick sanity check. :)

My PVE node is currently showing No KSM usage.
1757736085897.png

I'm setting up an Ubuntu 24.04.3 VM, and just noticed that it's using a lot of Host Memory vs. what the VM itself actually reports using.1757736186049.png

The VM itself is actually only using about a tenth of that, per free:
Bash:
~$ free -m
               total        used        free      shared  buff/cache   available
Mem:           15971         719       14104          14        1454       15252
Swap:           2047           0        2047

Is this just a consequence of the ballooning device being disabled, so that QEMU-Guest-Agent can't report usage correctly, or is there an actual potential problem here?
 

Attachments

  • 1757736172315.png
    1757736172315.png
    58.4 KB · Views: 0
PVE 9 is a bit different in this regard to older versions: https://pve.proxmox.com/wiki/Upgrade_from_8_to_9#VM_Memory_Consumption_Shown_is_Higher
Without the ballooning device QEMU/KVM will be guessing (by tha highest memory access from within the VM?), so any value shown is not wrong. Note that Proxmox does not really support overcommit on memory, so you might as well assume that each VM uses it's maximum amount of memory (regardless what value is shown), when ballooning is disabled (or not active).
 
PVE 9 is a bit different in this regard to older versions: https://pve.proxmox.com/wiki/Upgrade_from_8_to_9#VM_Memory_Consumption_Shown_is_Higher
Without the ballooning device QEMU/KVM will be guessing (by tha highest memory access from within the VM?), so any value shown is not wrong. Note that Proxmox does not really support overcommit on memory, so you might as well assume that each VM uses it's maximum amount of memory (regardless what value is shown), when ballooning is disabled (or not active).
Thanks! I figured this is normal, but like I said, I needed a sanity check. ;)

I know that the ballooning device has to be turned off when using PCI(e) passthrough, and I understand why, but it's always a little bit frustrating since the PVE VM status widget depends on it for accurate RAM usage statistics.

There are ways to monitor from directly inside a VM, but that's a lot more tedious. And in the back of my mind it's always extra stress knowing the machine is lying to me.

EDIT: I just booted the VM back up, and now "Host Memory Usage" is reporting at 1.46 GiB. That seems much more reasonable for a fresh boot. I'll have to keep an eye on it.
 
Last edited:
I know that the ballooning device has to be turned off when using PCI(e) passthrough, and I understand why, but it's always a little bit frustrating since the PVE VM status widget depends on it for accurate RAM usage statistics.
The ballooning device does not need to be turned off or removed from the VM at all. It's just that no memory can be reclaimed while using passthrough (because of DMA etc.). Best to have the ballooning device enabled for the VM if you want reports on memory usage.

EDIT: There is a difference between enabling/adding or disabling/removing the ballooning device to/from the VM and allowing the ballooning device to balloon (and take memory back for the Proxmox host) by setting the Minimum memory lower than the (maximum) Memory (and this is what is ignored when using PCI(e) passthrough).
 
Last edited:
The ballooning device does not need to be turned off or removed from the VM at all. It's just that no memory can be reclaimed while using passthrough (because of DMA etc.). Best to have the ballooning device enabled for the VM if you want reports on memory usage.

Thanks for calling that out. I'm testing this now and getting a basically accurate RAM measure in the PVE GUI. I assume this works the same way for Windows VMs with the QEMU Guest Agent/VirtiO package installed?

EDIT: There is a difference between enabling/adding or disabling/removing the ballooning device to/from the VM and allowing the ballooning device to balloon (and take memory back for the Proxmox host) by setting the Minimum memory lower than the (maximum) Memory (and this is what is ignored when using PCI(e) passthrough).

This is a really important clarification and clears things up nicely. :) A lot of guides I read don't go deep into that, and it gets condensed down into "you can't allow memory size to change in the VM, so turn off the ballooning device."

I think a lot of those guides are older and don't account for the fact we can tune the minimum size to match the maximum size so it never changes.
Or, you know, this stuff is just complicated and confusing when you're learning. ;)

Thanks again for your help.