kvm memória do host vs memória do convidado [duplicata]

0

Agora estou tentando entender a sobrecarga de memória do qemu-kvm. a partir do sistema operacional host, podemos encontrar -m 8192, o que significa que eu aloquei 8GB de memória para convidado.

qemu     2813877  0.5  0.2 30472752 1103620 ?    Sl   Jan05 1178:13 /usr/libexec/qemu-kvm -name instance-000003db -S -machine pc-i440fx-rhel7.1.0,accel=kvm,usb=off -cpu Haswell,+abm,+pdpe1gb,+rdrand,+f16c,+osxsave,+dca,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme,-rtm,-hle -m 8192 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid 886db7b2-79b6-4a8a-8b34-4e7001377da9 -smbios type=1,manufacturer=Fedora Project,product=OpenStack Nova,version=12.0.5-2.el7.centos.ustack,serial=168f720b-7801-453d-8d2e-99aed5ade6cd,uuid=886db7b2-79b6-4a8a-8b34-4e7001377da9,family=Virtual Machine -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-instance-000003db/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=rbd:openstack-00/886db7b2-79b6-4a8a-8b34-4e7001377da9_disk.config:id=admin:key=AQD7kyJQQGoOBhAAqrPAqSopSwPrrfMMomzVdw==:auth_supported=cephx\;none:mon_host=55.3.52.1\:6789\;55.3.52.11\:6789\;55.3.52.21\:6789,if=none,id=drive-ide0-1-1,readonly=on,format=raw,cache=writeback -device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 -drive file=rbd:openstack-00/volume-beeea3a3-44c8-4c36-835c-08bfdc9f61db:id=admin:key=AQD7kyJQQGoOBhAAqrPAqSopSwPrrfMMomzVdw==:auth_supported=cephx\;none:mon_host=55.3.52.1\:6789\;55.3.52.11\:6789\;55.3.52.21\:6789,if=none,id=drive-virtio-disk0,format=raw,serial=beeea3a3-44c8-4c36-835c-08bfdc9f61db,cache=writeback -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=rbd:openstack-00/volume-3be22eb0-6847-4366-a1ac-fcc8ddd87761:id=admin:key=AQD7kyJQQGoOBhAAqrPAqSopSwPrrfMMomzVdw==:auth_supported=cephx\;none:mon_host=55.3.52.1\:6789\;55.3.52.11\:6789\;55.3.52.21\:6789,if=none,id=drive-virtio-disk1,format=raw,serial=3be22eb0-6847-4366-a1ac-fcc8ddd87761,cache=writeback -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,id=virtio-disk1 -drive file=rbd:openstack-00/volume-4630e604-d404-4492-b861-44785274595f:id=admin:key=AQD7kyJQQGoOBhAAqrPAqSopSwPrrfMMomzVdw==:auth_supported=cephx\;none:mon_host=55.3.52.1\:6789\;55.3.52.11\:6789\;55.3.52.21\:6789,if=none,id=drive-virtio-disk2,format=raw,serial=4630e604-d404-4492-b861-44785274595f,cache=writeback -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk2,id=virtio-disk2 -netdev tap,fd=31,id=hostnet0,vhost=on,vhostfd=32 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=fa:16:3e:43:9b:d4,bus=pci.0,addr=0x3 -chardev file,id=charserial0,path=/var/lib/nova/instances/886db7b2-79b6-4a8a-8b34-4e7001377da9/console.log -device isa-serial,chardev=charserial0,id=serial0 -chardev pty,id=charserial1 -device isa-serial,chardev=charserial1,id=serial1 -device usb-tablet,id=input0 -vnc 0.0.0.0:2 -k en-us -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 -msg timestamp=on

Além disso, encontrei esta parte da memória em /proc/pid/smaps ; a partir disso, podemos saber que era igual a 8192MB.

7f6714000000-7f6914000000 rw-p 00000000 00:00 0
Size:            8388608 kB ===>8192MB
Rss:              953304 kB
Pss:              953304 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:      8508 kB
Private_Dirty:    944796 kB
Referenced:       927352 kB
Anonymous:        953304 kB
AnonHugePages:    839680 kB
Swap:             455556 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Locked:                0 kB

Mas, quando eu uso 'free' para verificar o tamanho da memória sob o sistema operacional convidado, restam apenas 7872MB no guestOS.

[root@host-10-3-0-221 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          7872        950       6921          0        220        303
-/+ buffers/cache:        426       7446
Swap:         8191          0       8191

Eu gostaria de saber por que o total de hóspedes com menos de 8192MB.

    
por JiongMingQi 01.06.2017 / 09:37

1 resposta

0

Eu vejo isso tanto no KVM quanto no VMWare e o motivo é devido à sobrecarga de memória usada pelo Hypervisor para manipular as máquinas virtuais, por exemplo, para permitir a supercomprometimento de memória e a alocação dinâmica e o trabalho de memória compartilhada.

Eu não encontrei nenhum artigo específico da kvm, mas o fórum da vmware tem um bom tópico sobre o assunto: link

    
por 01.06.2017 / 10:48