On 12/14/2010 06:55 AM, Daniel De Graaf wrote:
> -static int unmap_grant_pages(struct grant_map *map, int offset, int pages)
> +static void unmap_grant_pages(struct grant_map *map, int offset, int pages)
> {
> - int i, err = 0;
> + int i, flags, err = 0;
> + struct gnttab_unmap_grant_ref *unmap_ops;
> + struct gnttab_unmap_grant_ref unmap_single;
> +
> + if (pages > 1) {
> + unmap_ops = kzalloc(sizeof(unmap_ops[0]) * pages,
> + GFP_TEMPORARY);
> + if (unlikely(!unmap_ops)) {
> + for(i=0; i < pages; i++)
> + unmap_grant_pages(map, offset + i, 1);
> + return;
> + }
> + } else {
> + unmap_ops = &unmap_single;
> + }
Rather than doing this, it would be better to use the multicall batching
API, in particular xen_mc_extend_args() - see xen_extend_mmu_update()
for an example.
(This would mean promoting arch/x86/xen/multicall.h to
include/xen/multicall.h and breaking ia64 builds until there's an ia64
implementation of that API, but that seems like a fair tradeoff at this
point.)
J
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|