Open ddiss opened 9 months ago
Can you please prepare PR with 1. or 3.? We could test it for some time before merged.
mmap(0x7ef693e00000, 53687091200, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)
But MAP_POPULATE
is not set. Hm, ~MAP_NORESERVE
actually strongly depends on available swap space. That leads me to 4th option:
Leave the things as-is and let the host admin tweak overcommit params (e.g. /proc/sys/vm/overcommit_ratio
if you don't want to add swap for this qemu)
I was under the impression that qemu overcommited memory by default, until I ran into good ol':
Some
strace
ing later, against a VM with 50G memory assigned, showed that qemu attempts tommap()
the entire guest memory area via:Guest memory overcommitting should be as simple as ensuring that
MAP_NORESERVE
is present in the above flags. Working backwards fromqemu_ram_is_noreserve()
, the qemu command line parameters to ensureMAP_NORESERVE
appear to be:...instead of the simple
-m $mem
parameter that we currently use.I'm not sure of the best way to let rapido use memory overcommit. There are a few options:
_rt_qemu_resources_get() -m $mem
snippet with the above-object memory-backend-ram...reserve=off
parameters.QEMU_EXTRA_ARGS
_rt_mem_overcommit_resources_set
, with (1) logic enabled if the overcommit flag is detected.If overcommit were possible via a simple
-overcommit-memory
parameter (alongside-m $mem
), then I'd definitely opt for (2), but the fact thatsize=${mem}
needs to be present with the-object memory-backend-ram
parameter means that VM memory resource requirements specified in the cut script via_rt_mem_resources_set
can't easily be considered at boot time. I really, really, really don't want rapido to go down the path of acting as a map between local configs and qemu cli parameters similar to libvirt. I'm concerned that option (1) leads us further in that direction.