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
|