[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5278CCC4.3020501@citrix.com>
Date: Tue, 5 Nov 2013 10:47:32 +0000
From: David Vrabel <david.vrabel@...rix.com>
To: Roger Pau Monne <roger.pau@...rix.com>
CC: <xen-devel@...ts.xen.org>, <linux-kernel@...r.kernel.org>,
Stefano Stabellini <stefano.stabellini@...citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Subject: Re: [PATCH v3] p2m: use GNTTABOP_unmap_and_duplicate if available
On 04/11/13 15:38, Roger Pau Monne wrote:
> The new GNTTABOP_unmap_and_duplicate operation doesn't zero the
> mapping passed in new_addr, allowing us to perform batch unmaps in p2m
> code without requiring the use of a multicall.
Should the grant maps should be batched in a similar way?
> +int m2p_remove_override_batch(struct page **pages,
> + struct gnttab_map_grant_ref *kmap_ops, int count)
> +{
> + struct gnttab_unmap_and_duplicate *unmap_ops = NULL;
> + int ret = 0, i;
> +
> + for (i = 0; i < count; i++) {
> + ret = remove_page_override(pages[i]);
> + if (ret)
> + goto out;
> + }
> +
> + if (kmap_ops != NULL) {
> + struct page *scratch_page = get_balloon_scratch_page();
> + unsigned long scratch_page_address = (unsigned long)
> + __va(page_to_pfn(scratch_page) << PAGE_SHIFT);
> + int invcount = 0;
> +
> + unmap_ops = kcalloc(count, sizeof(unmap_ops[0]), GFP_KERNEL);
> + if (!unmap_ops) {
> + put_balloon_scratch_page();
> + ret = -ENOMEM;
> + goto out;
> + }
A memory allocation failure here looks bad as the grants will not be
unmapped which will have an impact on the granter domain. Either: a)
the unmap ops should be constructed in advance (excluding high mem pages
at that point); or b) this should use a statically allocated per-cpu
array of unmap ops with the batch split as necessary to fit into the
static array.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists