xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <juergen.gross@ts.fujitsu.com>
To: xen-devel@lists.xensource.com
Cc: george.dunlap@eu.citrix.com
Subject: [PATCH 2 of 4] xen 4.0: tools: Save superpages in the same batch, to make detection easier
Date: Fri, 13 Jul 2012 11:28:15 +0200	[thread overview]
Message-ID: <8b1e10c2494fd31f2ca5.1342171695@nehalem1> (raw)
In-Reply-To: <patchbomb.1342171693@nehalem1>

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

On the first time through (when pfns are mostly allocated on
the receiving side), try to keep superpages together in the same
batch by ending a batch early if we see the first page of a
potential superpage and there isn't enough room in the batch
for a full superpage.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>


1 file changed, 12 insertions(+)
tools/libxc/xc_domain_save.c |   12 ++++++++++++



[-- Attachment #2: xen-4.0-testing.hg-4.patch --]
[-- Type: text/x-patch, Size: 2157 bytes --]

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1342171663 -7200
# Node ID 8b1e10c2494fd31f2ca53926cca2993dff045125
# Parent  b2d7c4238c2f488d6d19b4b1be5e836872e276bd
xen 4.0: tools: Save superpages in the same batch, to make detection easier

On the first time through (when pfns are mostly allocated on
the receiving side), try to keep superpages together in the same
batch by ending a batch early if we see the first page of a
potential superpage and there isn't enough room in the batch
for a full superpage.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r b2d7c4238c2f -r 8b1e10c2494f tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c	Fri Jul 13 11:27:41 2012 +0200
+++ b/tools/libxc/xc_domain_save.c	Fri Jul 13 11:27:43 2012 +0200
@@ -67,6 +67,11 @@ struct outbuf {
     (((_mfn) < (ctx->max_mfn)) &&                \
      ((mfn_to_pfn(_mfn) < (dinfo->p2m_size)) &&   \
       (pfn_to_mfn(mfn_to_pfn(_mfn)) == (_mfn))))
+
+#define SUPERPAGE_PFN_SHIFT  9
+#define SUPERPAGE_NR_PFNS    (1UL << SUPERPAGE_PFN_SHIFT)
+
+#define SUPER_PAGE_START(pfn)    (((pfn) & (SUPERPAGE_NR_PFNS-1)) == 0 )
 
 /*
 ** During (live) save/migrate, we maintain a number of bitmaps to track
@@ -866,6 +871,7 @@ int xc_domain_save(int xc_handle, int io
     int rc = 1, frc, i, j, last_iter = 0, iter = 0;
     int live  = (flags & XCFLAGS_LIVE);
     int debug = (flags & XCFLAGS_DEBUG);
+    int superpages = !!hvm;
     int race = 0, sent_last_iter, skip_this_iter;
     int tmem_saved = 0;
 
@@ -1228,6 +1234,12 @@ int xc_domain_save(int xc_handle, int io
                            (test_bit(n, to_fix)  && last_iter)) )
                         continue;
 
+                    /* First time through, try to keep superpages in the same batch */
+                    if ( superpages && iter == 1
+                         && SUPER_PAGE_START(n)
+                         && batch + SUPERPAGE_NR_PFNS > MAX_BATCH_SIZE )
+                        break;
+
                     /*
                     ** we get here if:
                     **  1. page is marked to_send & hasn't already been re-dirtied

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2012-07-13  9:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-13  9:28 [PATCH 0 of 4] Xen 4.0 backport of cs 23420-23423 Juergen Gross
2012-07-13  9:28 ` [PATCH 1 of 4] xen 4.0: tools: libxc: Detect superpages on domain restore Juergen Gross
2012-07-13  9:28 ` Juergen Gross [this message]
2012-07-13  9:28 ` [PATCH 3 of 4] xen 4.0: tools: Introduce "allocate-only" page type for migration Juergen Gross
2012-07-13  9:28 ` [PATCH 4 of 4] xen 4.0: tools: Enable superpages for HVM domains by default Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b1e10c2494fd31f2ca5.1342171695@nehalem1 \
    --to=juergen.gross@ts.fujitsu.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).