]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Implement memoryBacking/discard
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 12 Apr 2018 15:16:40 +0000 (17:16 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 14 May 2018 07:42:21 +0000 (09:42 +0200)
commit2c4affd57e1746183ff410c023face80866bbe0f
tree40f8a94cad41ce4196e34efc327aca87bf9e835a
parent2300c92fe0d596258ed2f7da1b867d0ce2112f90
qemu: Implement memoryBacking/discard

https://bugzilla.redhat.com/show_bug.cgi?id=1480668

QEMU has this new feature memory-backend-file.discard-data=yes
which is a nifty optimization. Basically, when qemu is quitting
or on memory hotplug it calls munmap() and close() on the file
that is backing the memory. However, this does not mean kernel
won't stop touching that part of memory. It still might. With
this feature enabled we tell kernel: "we don't need this memory
nor data stored in it". This makes kernel drop the memory
immediately without trying to sync memory with the mapped file.

Unfortunately, this cannot be turned on by default because we
can't be sure when users really don't care about what happens to
data after qemu dies. So it has to be opt-in. As usual, there are
three places where one can configure memory attributes. This
patch adds the feature to all of them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/hugepages-pages.args
tests/qemuxml2argvdata/hugepages-pages3.args
tests/qemuxml2argvdata/hugepages-pages7.args
tests/qemuxml2argvtest.c