Re: [Qemu-devel] [PATCH 07/40] virtio: slim down allocation of VirtQueueElements

2015-11-30 Thread Paolo Bonzini
On 30/11/2015 04:24, Fam Zheng wrote: > > +for (i = 0; i < out_num; i++) { > > +elem->out_addr[i] = addr[i]; > > +elem->out_sg[i] = iov[i]; > > +} > > Isn't memcpy more efficient here? Otherwise looks good. Probably not, out_num/in_num is usually very small, in fact one o

Re: [Qemu-devel] [PATCH 07/40] virtio: slim down allocation of VirtQueueElements

2015-11-29 Thread Fam Zheng
On Tue, 11/24 19:00, Paolo Bonzini wrote: > 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. > > When virtqueue_ma