Skip to contentSkip to conversation

Enabling vhost-net cause insane high memory usage.

Qemu-devel Piotr Karbowski 4 participants 5 messages Jan 9, 2014 – Jan 15, 2014

lore
Share & tools
lore
#0 lore raw

Hello,

kernel 3.12.5, qemu-1.7.0.

With vhost=on, qemu shortly after start uses all its assigned memory (2G for example), without vhost-net enabled it does not go to more than 200 MB on my idling test virtual machine. 100% reproducable. I think its not how it should be.

Full command:
/usr/bin/qemu-system-x86_64 -machine accel=kvm -name _debian -usb -machine accel=kvm -cpu host,level=9 -smp cpus=2 -vga std -monitor unix://home/piotr/src/vmninja/sockets/_debian.monitor.socket,server,nowait -vnc unix://home/piotr/src/vmninja/sockets/_debian.vnc.socket -m 2048 -boot order=d,menu=on -drive if=ide,index=2,media=cdrom,id=virtcd -netdev tap,id=if0,helper=/usr/libexec/qemu-bridge-helper --br=lebridge0 -device virtio-net-pci,netdev=if0,mac=de:ee:b3:9e:a3:d5,romfile= -drive file=/home/piotr/virt/kvm/_debian.raw,if=virtio,cache=writeback

-- Piotr.

#1 lore raw
Quoted 16 lines · Piotr Karbowski

kernel 3.12.5, qemu-1.7.0.

With vhost=on, qemu shortly after start uses all its assigned memory (2G for example), without vhost-net enabled it does not go to more than 200 MB on my idling test virtual machine. 100% reproducable. I think its not how it should be.

Full command:
/usr/bin/qemu-system-x86_64 -machine accel=kvm -name _debian -usb

(quoted diff) +0 -2
-machine accel=kvm -cpu host,level=9 -smp cpus=2 -vga std -monitor unix://home/piotr/src/vmninja/sockets/_debian.monitor.socket,server,nowait
-vnc unix://home/piotr/src/vmninja/sockets/_debian.vnc.socket -m

2048 -boot order=d,menu=on -drive if=ide,index=2,media=cdrom,id=virtcd -netdev tap,id=if0,helper=/usr/libexec/qemu-bridge-helper --br=lebridge0

(quoted diff) +0 -2
-device virtio-net-pci,netdev=if0,mac=de:ee:b3:9e:a3:d5,romfile=
-drive
Quoted 1 line

file=/home/piotr/virt/kvm/_debian.raw,if=virtio,cache=writeback

How are you measuring memory usage? Please post the output of the command.

Did previous kernel/qemu versions work better?

Maybe Michael or Jason can give you hints on debugging this.

Stefan

#2 lore raw
In reply to Piotr Karbowski
Quoted 7 lines · Piotr Karbowski

Hello,

kernel 3.12.5, qemu-1.7.0.

With vhost=on, qemu shortly after start uses all its assigned memory (2G for example), without vhost-net enabled it does not go to more than 200 MB on my idling test virtual machine.

Could you explain how you measure that exactly?

Quoted 14 lines

100% reproducable. I
think its not how it should be.

Full command:
/usr/bin/qemu-system-x86_64 -machine accel=kvm -name _debian -usb

(quoted diff) +0 -2
-machine accel=kvm -cpu host,level=9 -smp cpus=2 -vga std -monitor unix://home/piotr/src/vmninja/sockets/_debian.monitor.socket,server,nowait
-vnc unix://home/piotr/src/vmninja/sockets/_debian.vnc.socket -m

2048 -boot order=d,menu=on -drive if=ide,index=2,media=cdrom,id=virtcd -netdev tap,id=if0,helper=/usr/libexec/qemu-bridge-helper --br=lebridge0

(quoted diff) +0 -2
-device virtio-net-pci,netdev=if0,mac=de:ee:b3:9e:a3:d5,romfile=
-drive

file=/home/piotr/virt/kvm/_debian.raw,if=virtio,cache=writeback

Quoted 1 line

-- Piotr.

Yes, this should not happen.
One interesting thing to try would be switching device type from virtio-net to e1000.

This means vhost will be initialized but not started.

Signature · 1 line
MST
#3 lore raw

Hello,

Quoted 3 lines · Michael S. Tsirkin

Could you explain how you measure that exactly?

I check the resident memory (RES) of qemu-system-x86_64 proces.

Quoted 6 lines

Yes, this should not happen.
One interesting thing to try would be switching device type from virtio-net to e1000.

This means vhost will be initialized but not started.

So with virtio-net-pci + vhost=on I have VM process on 580-590 MB of RES memory, if I disable vhost OR set e1000 NIC and leave vhost enabled, its take just 109-120 MB of resident memory.

The memory usage check is done after few minutes after VM start, and the vm have minimal debian7 system without even single additional service.

-- Piotr.

#4 lore raw
Quoted 17 lines · Piotr Karbowski

Hello,

Quoted 3 lines · Michael S. Tsirkin

Could you explain how you measure that exactly?

I check the resident memory (RES) of qemu-system-x86_64 proces.

Quoted 6 lines

Yes, this should not happen.
One interesting thing to try would be switching device type from virtio-net to e1000.

This means vhost will be initialized but not started.

Quoted 6 lines

So with virtio-net-pci + vhost=on I have VM process on 580-590 MB of RES memory, if I disable vhost OR set e1000 NIC and leave vhost enabled, its take just 109-120 MB of resident memory.

The memory usage check is done after few minutes after VM start, and the vm have minimal debian7 system without even single additional service.

Quick note, the test was done on VM with 512 MB memory set, if I test it on the 2 GB one, RES with vhost-enabled virtio-net-pci goes a bit above 2 GB shortly after start.

-- Piotr.