From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Fitzhardinge Subject: Re: [PATCH 3/6] xen-gntdev: Remove unneeded structures from grant_map tracking data Date: Tue, 14 Dec 2010 13:54:55 -0800 Message-ID: <4D07E7AF.7000101@goop.org> References: <1292338553-20575-1-git-send-email-dgdegra@tycho.nsa.gov> <1292338553-20575-4-git-send-email-dgdegra@tycho.nsa.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1292338553-20575-4-git-send-email-dgdegra@tycho.nsa.gov> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Daniel De Graaf Cc: Isaku Yamahata , xen-devel@lists.xensource.com, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org 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