From: "Jan Beulich" Subject: Re: [PATCHv13 2/2] gnttab: steal maptrack entries from other VCPUs Date: Tue, 16 Jun 2015 07:36:09 +0100 Message-ID: <557FDFF90200007800085377@mail.emea.novell.com> References: <1434379671-20327-1-git-send-email-david.vrabel@citrix.com> <1434379671-20327-3-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z4kTm-0006HJ-Ci for xen-devel@lists.xenproject.org; Tue, 16 Jun 2015 06:36:14 +0000 In-Reply-To: <1434379671-20327-3-git-send-email-david.vrabel@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: xen-devel@lists.xenproject.org, Keir Fraser , Ian Campbell , Tim Deegan List-Id: xen-devel@lists.xenproject.org >>> On 15.06.15 at 16:47, wrote: > +static int steal_maptrack_handle(struct grant_table *t, struct vcpu *v) > +{ > + struct domain *d = v->domain; I think this and the vcpu pointer can be const. Also it looks like they should be named currd and curr respectively (the latter would also apply to get_maptrack_handle() in patch 1). > + unsigned int first, i; > + > + /* Find an initial victim. */ > + first = i = NOW() % d->max_vcpus; Do you think NOW() is cheaper than get_random(), or is there any other reason you use time as a pseudo random number here? > + do { > + unsigned int handle; > + > + handle = __get_maptrack_handle(t, d->vcpu[i]); Elsewhere we're trying to be careful not to run into d->vcpu[] slots being NULL - I think this should be done here too. Jan