| Summary: | [virtio] virtio-balloon does not balloon correctly | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | lysfjord.daniel | ||||||
| Component: | kern | Assignee: | freebsd-virtualization (Nobody) <virtualization> | ||||||
| Status: | In Progress --- | ||||||||
| Severity: | Affects Only Me | CC: | bms, emaste, pouria, rootnode+freebsd, xiangzhedev | ||||||
| Priority: | --- | ||||||||
| Version: | 14.3-RELEASE | ||||||||
| Hardware: | amd64 | ||||||||
| OS: | Any | ||||||||
| See Also: | https://github.com/freebsd/freebsd-src/pull/2116 | ||||||||
| Attachments: |
|
||||||||
|
Description
lysfjord.daniel
2026-01-18 16:58:56 UTC
> See also #198344 and #277473 Clickable links to the two closed reports: bug 198344, bug 277473. Hi, I had create a PR to improve virtio-balloon, can you test it to check if is it fix the error what you see? https://github.com/freebsd/freebsd-src/pull/2116 Thanks a lot (In reply to Xiangzhe from comment #2) It *seems* to be a step in the right direction.. The allocation shrinks by 1MiB every apx. 5 seconds now, and it seems to be going until the target set. I guess dev.vtballoon.0.current and dev.vtballoon.0.desired are in some other unit than KiB.. it's moving in steps of 256 per time virt-manager say it has adjusted the current allocation with 1MiB, pointing me to it being in 4k pages? Since your code has #define VTBALLOON_PAGES_PER_REQUEST 256 I guess the reasoning is sound.. No idea why it only request changes once every 5 seconds, or thereabouts, but at least it tries to work now:) Thank you for test. 256 is reference the Linux kernel source code. And I had push new chance to PR, can you test it if is it fix the slow shrinks? This looks very good:) Can I now have it backported to 14.4, so I can use it on my poudriere-machine?:) Created attachment 269744 [details]
14.4-backport-virtio-balloon-oom
(In reply to Xiangzhe from comment #6) Perfect:) Now, if only the code on the hypervisor-side could care to ask the VM to release memory when under pressure.. But that's not your fault. The only weird thing, is that the module doesn't start reporting data until I look at the statistics in virt-manager (whatever it's sending when looking at the memory usage). Before that, it reports nothing. (In reply to lysfjord.daniel from comment #8) Nevermind previous comment. Wrong VM.. Looking at it, there's something strange until I look at the vm in virt-manager. Usable seems to be very close to available for some reason, and the faults are not reported. This is on a 14.4 VM. # Before looking ❯ virsh dommemstat "FreeBSD buildd" actual 3140608 swap_in 0 swap_out 0 major_fault 0 minor_fault 0 unused 18224420 available 18296048 usable 18224420 last_update 1776893227 disk_caches 0 rss 2487048 # After Looking ❯ virsh dommemstat "FreeBSD buildd" actual 3140608 swap_in 0 swap_out 0 major_fault 503 minor_fault 107626 unused 2167724 available 18296048 usable 2153348 last_update 1776894685 disk_caches 19412 rss 2491400 Created attachment 270010 [details]
Diff in sysctl -a
Before is before starting virt-manager, after is, after..
|