qemu-e2k/hw/9pfs
Paolo Bonzini 51b19ebe43 virtio: move allocation to virtqueue_pop/vring_pop
The return code of virtqueue_pop/vring_pop is unused except to check for
errors or 0.  We can thus easily move allocation inside the functions
and just return a pointer to the VirtQueueElement.

The advantage is that we will be able to allocate only the space that
is needed for the actual size of the s/g list instead of the full
VIRTQUEUE_MAX_SIZE items.  Currently VirtQueueElement takes about 48K
of memory, and this kind of allocation puts a lot of stress on malloc.
By cutting the size by two or three orders of magnitude, malloc can
use much more efficient algorithms.

The patch is pretty large, but changes to each device are testable
more or less independently.  Splitting it would mostly add churn.

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>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-02-06 20:39:07 +02:00
..
9p-handle.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
9p-local.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
9p-posix-acl.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
9p-proxy.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
9p-proxy.h
9p-synth.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
9p-synth.h
9p-xattr-user.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
9p-xattr.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
9p-xattr.h
9p.c virtio: move allocation to virtqueue_pop/vring_pop 2016-02-06 20:39:07 +02:00
9p.h
codir.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
cofile.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
cofs.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
coth.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
coth.h
coxattr.c 9pfs: Clean up includes 2016-01-29 15:07:23 +00:00
Makefile.objs
virtio-9p-device.c virtio: move allocation to virtqueue_pop/vring_pop 2016-02-06 20:39:07 +02:00
virtio-9p.h virtio: move allocation to virtqueue_pop/vring_pop 2016-02-06 20:39:07 +02:00