WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] tools: fix build after recent xenpaging changes

To: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] tools: fix build after recent xenpaging changes
From: Olaf Hering <olaf@xxxxxxxxx>
Date: Fri, 24 Jun 2011 17:24:45 +0200
Cc: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 24 Jun 2011 08:25:33 -0700
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1308929086; l=1555; s=domk; d=aepfle.de; h=In-Reply-To:Content-Type:MIME-Version:References:Subject:Cc:To:From: Date:X-RZG-CLASS-ID:X-RZG-AUTH; bh=E5k8qXs0Pu8Y8BNrxKrn7UmtN+8=; b=R6oz6H4IZFH+Fv1/qXtUR/foYpNd3ZCCZm+vCKyXiNB06mIIg8vxZ4vz6aKJ0P3Z/jP e0rrty8Ydop1jwNzbLXfgVsR6Z/BoDthYTg3Qy6ZI/qPkX3ZIzDkzpoXNpjTdY+HZgC3W xhVLEk8SfRCgYS3yFK07eHkYNbW1UEDSRrs=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1308926473.32717.129.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20110624121613.GA17634@xxxxxxxxxxxxxxxxxxxxxxx> <1308918826.32717.85.camel@xxxxxxxxxxxxxxxxxxxxxx> <20110624133201.GB27793@xxxxxxxxx> <1308923299.32717.109.camel@xxxxxxxxxxxxxxxxxxxxxx> <20110624135708.GA28839@xxxxxxxxx> <1308925806.32717.119.camel@xxxxxxxxxxxxxxxxxxxxxx> <20110624143511.GA30080@xxxxxxxxx> <1308926473.32717.129.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.21 (2010-12-30)
On Fri, Jun 24, Ian Campbell wrote:

> On Fri, 2011-06-24 at 15:35 +0100, Olaf Hering wrote:
> > On Fri, Jun 24, Ian Campbell wrote:
> > 
> > > > The break exits the for() loop, not the while(1). In the next iteration
> > > > page 1 may still be in paging->bitmap and tried again.
> > > 
> > > I'd missed the interrupted -> 1 in the while loop. I presume there is
> > > some other exit condition which triggers once everything has been paged
> > > back in and actually causes the daemon to exit?
> > 
> > If the for() loop found nothing, then this triggers:
> > 
> > 775             /* If no more pages to process, exit loop */
> > 776             if ( i == paging->domain_info->max_pages )
> > 777                 break;
> 
> Oh yes.
> 
> It's a bit counter intuitive to have a for loop which only processes the
> first thing it finds and then relying on going round another outer loop
> to pickup the second etc. It's at least O(N^2), isn't it?
> 
> Why not 
>       count = 0;
>       for ( i = 0; i < paging->domain_info->max_pages; i++ )
>             {
>                 if ( test_bit(i, paging->bitmap) )
>                 {
>                     page_in_trigger(i);
>                     count++
>                 }
>             }
>             /* If no more pages to process, exit loop */
>             if ( !count )
>                 break;
> 
> That will at least process as many pages as it can on each iteration
> through the outer loop. Although it will most likely exacerbate the
> locking issue I pointed to earlier.

I think an early version of my change had something like that, but it
did not fillup the ringbuffer for some reason.
I will look at this change again and see what can be improved.

Olaf

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel