vring: slim down allocation of VirtQueueElements
commit5dba97ebdc92f1ac3c9ac27d8eac52ed2348fae1
authorPaolo Bonzini <pbonzini@redhat.com>
Sun, 31 Jan 2016 10:29:02 +0000 (31 11:29 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Sat, 6 Feb 2016 18:44:08 +0000 (6 20:44 +0200)
treeb285c0bc5ec588da078298fb16bdfae84ce0383d
parent3b3b0628217e2726069990ff9942a5d6d9816bd7
vring: slim down allocation of VirtQueueElements

Build the addresses and s/g lists on the stack, and then copy them
to a VirtQueueElement that is just as big as required to contain this
particular s/g list.  The cost of the copy is minimal compared to that
of a large malloc.

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/dataplane/vring.c