lkml.org 
[lkml]   [2013]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2013-11-05 12:01    [W:0.066 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site