]> git.proxmox.com Git - qemu.git/commit
net: reduce the unnecessary memory allocation of multiqueue
authorJason Wang <jasowang@redhat.com>
Fri, 22 Feb 2013 15:15:06 +0000 (23:15 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 2 Apr 2013 15:28:29 +0000 (10:28 -0500)
commit3b39a11cde495b42776889031769d730cbfd0993
tree90e1503237c6465ed73850921f45e703371db06b
parentec9f828341cb5e9cc3ad0bdbbd6989884daf823a
net: reduce the unnecessary memory allocation of multiqueue

Edivaldo reports a problem that the array of NetClientState in NICState is too
large - MAX_QUEUE_NUM(1024) which will wastes memory even if multiqueue is not
used.

Instead of static arrays, solving this issue by allocating the queues on demand
for both the NetClientState array in NICState and VirtIONetQueue array in
VirtIONet.

Tested by myself, with single virtio-net-pci device. The memory allocation is
almost the same as when multiqueue is not merged.

Cc: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit f6b26cf257232e5854c0e5c98a8685c625bf986e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio-net.c
include/net/net.h
net/net.c