[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 03 of 16] amd iommu: Add iommu emulation for hvm guest



Hi, 

At 16:29 +0100 on 14 Dec (1323880164), Wei Wang wrote:
> +static struct page_info* guest_iommu_get_page(struct list_head *pglist,
> +                                              unsigned int entry_size,
> +                                              unsigned int pos)
> +{
> +    int idx;
> +    struct list_head *head;
> +    struct guest_pages *gpage = NULL;
> +
> +    idx = (pos * entry_size) >> PAGE_SHIFT;
> +    list_for_each( head, pglist )
> +    {
> +        gpage = list_entry(head, struct guest_pages, list);
> +        if ( (--idx) < 0 )
> +            break;
> +    }

Given that you allocate all these elements together, and free them, all
together, why not just use an array instead of a linked list?

Cheers,

Tim.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.