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 7 of 9] xenpaging: add resume_pages function

To: Olaf Hering <olaf@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 7 of 9] xenpaging: add resume_pages function
From: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Date: Thu, 15 Sep 2011 10:15:44 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 15 Sep 2011 02:16:20 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=kkRpsuBjUS3s/sI3K9m1aHrt9XdOHqzuZCXGEwLPYPs=; b=DBIfX6Cla4tlfZoxIgbIYmKvuqy2nLfueA/Hk5Nkedol3tUl7vI0u9XewESQy+S3TJ Splv6B32K/YoCSCT1AUpNQoe6Pnu90BVNAiC7JSgkhiOoQuUYdAfZahN5yv+GMEeU3Lo maYQfrKxmnBZLT+aw90GVt4r2k1o8+jYAhy2o=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <6987aa2dde4e93481f15.1316067395@xxxxxxxxxxxx>
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: <patchbomb.1316067388@xxxxxxxxxxxx> <6987aa2dde4e93481f15.1316067395@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, Sep 15, 2011 at 7:16 AM, Olaf Hering <olaf@xxxxxxxxx> wrote:
> # HG changeset patch
> # User Olaf Hering <olaf@xxxxxxxxx>
> # Date 1316067232 -7200
> # Node ID 6987aa2dde4e93481f1599735ed1a26defb6d6b9
> # Parent  3a3a5979b799d948802183d10d65894ee84a872f
> xenpaging: add resume_pages function
>
> Add new function to resume a couple of pages.
> This change is required by subsequent patches.

Olaf, if you end up re-submitting this patch series for any reason, I
would combine this patch and the previous patch, and make the
description something like this:

"Pull page eviction and resume loops into their own functions."  That
gives a better idea what's going on.  Since neither really makes any
functional changes, there's no need to have separate patches, IMHO.

(I don't think that in itself is worth rejecting the series for.)

 -George

>
> Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
>
> diff -r 3a3a5979b799 -r 6987aa2dde4e tools/xenpaging/xenpaging.c
> --- a/tools/xenpaging/xenpaging.c
> +++ b/tools/xenpaging/xenpaging.c
> @@ -554,6 +554,27 @@ static int xenpaging_populate_page(xenpa
>     return ret;
>  }
>
> +/* Trigger a page-in for a couple of pages */
> +static void resume_pages(xenpaging_t *paging, int num_pages)
> +{
> +    xc_interface *xch = paging->xc_handle;
> +    int i, num = 0;
> +
> +    for ( i = 0; i < paging->max_pages && num < num_pages; i++ )
> +    {
> +        if ( test_bit(i, paging->bitmap) )
> +        {
> +            paging->pagein_queue[num] = i;
> +            num++;
> +            if ( num == XENPAGING_PAGEIN_QUEUE_SIZE )
> +                break;
> +        }
> +    }
> +    /* num may be less than num_pages, caller has to try again */
> +    if ( num )
> +        page_in_trigger();
> +}
> +
>  static int evict_victim(xenpaging_t *paging,
>                         xenpaging_victim_t *victim, int fd, int i)
>  {
> @@ -785,25 +806,12 @@ int main(int argc, char *argv[])
>         /* Write all pages back into the guest */
>         if ( interrupted == SIGTERM || interrupted == SIGINT )
>         {
> -            int num = 0;
> -            for ( i = 0; i < paging->max_pages; i++ )
> -            {
> -                if ( test_bit(i, paging->bitmap) )
> -                {
> -                    paging->pagein_queue[num] = i;
> -                    num++;
> -                    if ( num == XENPAGING_PAGEIN_QUEUE_SIZE )
> -                        break;
> -                }
> -            }
> -            /*
> -             * One more round if there are still pages to process.
> -             * If no more pages to process, exit loop.
> -             */
> -            if ( num )
> -                page_in_trigger();
> -            else if ( i == paging->max_pages )
> +            /* If no more pages to process, exit loop. */
> +            if ( !paging->num_paged_out )
>                 break;
> +
> +            /* One more round if there are still pages to process. */
> +            resume_pages(paging, paging->num_paged_out);
>         }
>         else
>         {
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
>

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