aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_domain_save.c
diff options
context:
space:
mode:
authorGeorge Dunlap <george.dunlap@eu.citrix.com>2011-05-26 15:27:32 +0100
committerGeorge Dunlap <george.dunlap@eu.citrix.com>2011-05-26 15:27:32 +0100
commitbc14571cb1c03ed1691a520f444828f36b605116 (patch)
tree594f156352c4eba9cf1a39a8fc59862ff1cbe087 /tools/libxc/xc_domain_save.c
parent10835a4ccc91d8adad11285816d42a8b0cd1c9ba (diff)
downloadxen-bc14571cb1c03ed1691a520f444828f36b605116.tar.gz
xen-bc14571cb1c03ed1691a520f444828f36b605116.tar.bz2
xen-bc14571cb1c03ed1691a520f444828f36b605116.zip
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> Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxc/xc_domain_save.c')
-rw-r--r--tools/libxc/xc_domain_save.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
index c5c909ce1d..0c0e2fabde 100644
--- a/tools/libxc/xc_domain_save.c
+++ b/tools/libxc/xc_domain_save.c
@@ -83,6 +83,11 @@ struct outbuf {
((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
** which pages we have to send, to fixup, and to skip.
@@ -808,6 +813,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter
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 = 0;
unsigned int sent_this_iter = 0;
int tmem_saved = 0;
@@ -1159,6 +1165,12 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter
(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