[libvirt] [Qemu-devel] incorrect memory size inside vm

Piotr Rybicki piotr.rybicki at innervision.pl
Thu Jun 18 15:05:34 UTC 2015


W dniu 2015-06-18 o 00:57, Vasiliy Tolstov pisze:
> 2015-06-18 1:52 GMT+03:00 Andrey Korolyov <andrey at xdel.ru>:
>> Whoosh... technically it is possible but it would be an incompatible
>> fork for the upstreams for both SeaBIOS and Qemu, because the generic
>> way of plugging DIMMs in is available down to at least generic 2.6.32.
>> Except may be Centos where broken kabi would bring great consequences,
>> it may be better to just provide a backport repository with newer
>> kernels, but it doesn`t sound very optimistic. For the history
>> records, the initial hotplug support proposal provided by Vasilis
>> Liaskovitis a couple of years ago worked in an exact way you are
>> suggesting to, but its resurrection would mean emulator and rom code
>> alteration, as I said above.
>
>
> Ok, i'm try to build latest libvirt and check all oses for memory
> hotplug support =).
>

Hi guys.

I'm actually investigating mem waste issue at my lab. I'm using libvirt 
+ qemu on gentoo.

# libvirtd -v
2015-06-18 14:50:56.619+0000: 11720: info : libvirt version: 1.2.16

# qemu-x86_64 -version
qemu-x86_64 version 2.3.0, Copyright (c) 2003-2008 Fabrice Bellard

# uname -a
Linux vms06 3.18.14-gentoo #1 SMP Wed Jun 17 14:55:27 CEST 2015 x86_64 
AMD Opteron(tm) Processor 6380 AuthenticAMD GNU/Linux


When not using dimm (static or hotplugged) - only 'main' memory, waste 
is huge, especially if one define big limit.

my test with only 'plain' memory:
define domain.xml with different mem setting, and see mem sizes (virsh 
domstats DOMAIN --balloon from host and 'free' command from guest)

libvirt max: 2GB, curr: 2GB
system total: 2001
balloon.current=2097152
balloon.maximum=2097152


libvirt max: 4GB, curr: 4GB
system total: 3953
balloon.current=4194304
balloon.maximum=4194304

libvirt max: 4GB, curr: 2GB
system total: 1905
balloon.current=2097152
balloon.maximum=4194304


libvirt max: 8GB, curr: 8GB
system total: 7985
balloon.current=8388608
balloon.maximum=8388608

libvirt max: 8GB, curr: 4GB
system total: 3889
balloon.current=4194304
balloon.maximum=8388608

libvirt max: 8GB, curr: 2GB
system total: 1841
balloon.current=2097152
balloon.maximum=8388608


libvirt max: 16GB, curr: 16GB
system total: 16049
balloon.current=16777216
balloon.maximum=16777216

libvirt max: 16GB, curr: 8GB
system total: 7857
balloon.current=8388608
balloon.maximum=16777216

libvirt max: 16GB, curr: 4GB
system total: 3761
balloon.current=4194304
balloon.maximum=16777216

libvirt max: 16GB, curr: 2GB
system total: 1713
balloon.current=2097152
balloon.maximum=16777216

As You can see, when one set 16GB max mem and define current mem to 2GB, 
guest only see 1713 MB. When You set 2GB max mem and leave 2GB mem, 
guest see 2001. So there are 288 MB wasted.

Later, i tried to define 15 static 1GB dimms and 1GB 'main' memory, and 
later on decreased guest memory via balloon to 1GB, and there was no 
waste in guest.

But, when i checked RES size of qemu process on host, It was about 
5,5GB! In contrast, when using only 'main' memory, results were as 
expected (res mem for qemu was amount ram for guest + qemu itself).

Do You see similar results at Your side?

Best regards
Piotr Rybicki




More information about the libvir-list mailing list