From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v6 09/17] virtio: add minimal support for virtqueues Date: Fri, 11 Jul 2014 11:23:12 +0200 Message-ID: <53BFAD00.4000700@redhat.com> References: <1405066787-5793-1-git-send-email-drjones@redhat.com> <1405066787-5793-10-git-send-email-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: christoffer.dall@linaro.org To: Andrew Jones , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Return-path: Received: from mail-ig0-f169.google.com ([209.85.213.169]:49433 "EHLO mail-ig0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169AbaGKJXQ (ORCPT ); Fri, 11 Jul 2014 05:23:16 -0400 Received: by mail-ig0-f169.google.com with SMTP id r10so347524igi.0 for ; Fri, 11 Jul 2014 02:23:16 -0700 (PDT) In-Reply-To: <1405066787-5793-10-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 11/07/2014 10:19, Andrew Jones ha scritto: > +static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, > + unsigned index, > + void (*callback)(struct virtqueue *vq), > + const char *name) > +{ > + struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); > + struct vring_virtqueue *vq; > + void *queue; > + unsigned num = VIRTIO_MMIO_QUEUE_NUM_MIN; > + > + vq = alloc(sizeof(*vq)); You can move the allocation of vq to vm_find_vqs (interleaving alloc and alloc_aligned causes some fragmentation), allocating a single block instead of one per vq. Paolo > + queue = alloc_aligned(VIRTIO_MMIO_QUEUE_SIZE_MIN, PAGE_SIZE);