https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277473
Bug ID: 277473
Summary: Virtio memory ballooning does not return unused memory
to host
Product: Base System
Version: 14.0-RELEASE
Hardware: amd64
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: kern
Assignee: [email protected]
Reporter: [email protected]
The memory ballooning in a FreeBSD kvm/qemu guest does not seem to return the
unused memory to the host.
The ballooning seems to happen correctly within FreeBSD, but the host might not
be told properly (that's only my limited understanding as a non-expert).
This is true whether setting the current memory size automatically of manually.
Here are some scenarios to explain the problem.
=== Scenario 1
With currentMemory and memory both set to 64GB in the kvm config file
$ vmstat
procs memory page disks faults cpu
r b w avm fre flt re pi po fr sr nd0 pa0 in sy cs us sy id
0 0 0 429M 62G 2.3K 0 17 0 3.4K 4 0 0 76 2.2K 1.3K 0 1 99
neofetch shows:
Memory: 2272MiB / 65495MiB
On the Linux host, top shows:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
57685 libvirt+ 20 0 66.8g 64.2g 26112 S 0.0 51.1 1:01.37
qemu-system-x86
This is all as expected
=== Scenario 2
With currentMemory set to 8G and memory set to 64GB in the kvm config file
$ vmstat
procs memory page disks faults cpu
r b w avm fre flt re pi po fr sr nd0 pa0 in sy cs us sy id
0 0 0 429M 5.7G 3.1K 0 23 0 4.6K 4 0 0 1381 3.0K 3.5K 0 4 96
and now neofetch shows:
Memory: 59607MiB / 65495MiB
On the Linux host from the 'top' command:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
57062 libvirt+ 20 0 66.8g 64.2g 26112 S 0.0 51.0 1:32.51
qemu-system-x86
vmstat shows less available memory than in Scenario 1, as expected.
The host however sees no difference in memory usage from FreeBSD compared to
Scenario 1. Expected: the memory usage on the host should have decreased.
Interestingly, neofetch sees much more memory usage than previously. I don't
know if it's relevant, but it might be a clue so I'm including this here.
=== Scenario 3
With currentMemory and memory both set to 64GB in kvm config file, as in
Scenario 1. I type 'sudo virsh setmem FreeBSD 8G' on the host. FreeBSD's vmstat
initially shows 64G free, and transitions gradually to 5.7G free, as expected.
On the host side however, there is no change in the memory utilization of the
FreeBSD VM. Expected: the memory usage on the host should have decreased.
=== Test notes
The tests are done on a physical server with 32 cores (2 sockets), 64 threads,
128GB RAM.
The OS is Ubuntu 22.04
Other guests such as Windows and Linux behave as expected in kvm/qemu. The
memory usage inside the guest matches the memory usage seen from the host.
virtio_balloon.ko is compiled in kernel.
--
You are receiving this mail because:
You are the assignee for the bug.