# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1207750749 -3600
# Node ID e64d17985df5d25f2477d57632b9a2caa34bea33
# Parent 0553004fa328b86756a428410d21394fe62bd29a
save/restore: Batch contiguous page-sized writes together during domain save.
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
---
tools/libxc/xc_domain_save.c | 48 +++++++++++++++++++++++++++++++++----------
1 files changed, 37 insertions(+), 11 deletions(-)
diff -r 0553004fa328 -r e64d17985df5 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c Wed Apr 09 14:34:49 2008 +0100
+++ b/tools/libxc/xc_domain_save.c Wed Apr 09 15:19:09 2008 +0100
@@ -1048,7 +1048,7 @@ int xc_domain_save(int xc_handle, int io
/* Now write out each data page, canonicalising page tables as we go... */
for ( ; ; )
{
- unsigned int prev_pc, sent_this_iter, N, batch;
+ unsigned int prev_pc, sent_this_iter, N, batch, run;
iter++;
sent_this_iter = 0;
@@ -1225,6 +1225,7 @@ int xc_domain_save(int xc_handle, int io
}
/* entering this loop, pfn_type is now in pfns (Not mfns) */
+ run = 0;
for ( j = 0; j < batch; j++ )
{
unsigned long pfn, pagetype;
@@ -1233,7 +1234,25 @@ int xc_domain_save(int xc_handle, int io
pfn = pfn_type[j] & ~XEN_DOMCTL_PFINFO_LTAB_MASK;
pagetype = pfn_type[j] & XEN_DOMCTL_PFINFO_LTAB_MASK;
- /* write out pages in batch */
+ if ( pagetype != 0 )
+ {
+ /* If the page is not a normal data page, write out any
+ run of pages we may have previously acumulated */
+ if ( run )
+ {
+ if ( ratewrite(io_fd, live,
+ (char*)region_base+(PAGE_SIZE*(j-run)),
+ PAGE_SIZE*run) != PAGE_SIZE*run )
+ {
+ ERROR("Error when writing to state file (4a)"
+ " (errno %d)", errno);
+ goto out;
+ }
+ run = 0;
+ }
+ }
+
+ /* skip pages that aren't present */
if ( pagetype == XEN_DOMCTL_PFINFO_XTAB )
continue;
@@ -1255,23 +1274,30 @@ int xc_domain_save(int xc_handle, int io
if ( ratewrite(io_fd, live, page, PAGE_SIZE) != PAGE_SIZE )
{
- ERROR("Error when writing to state file (4)"
+ ERROR("Error when writing to state file (4b)"
" (errno %d)", errno);
goto out;
}
}
else
{
- /* We have a normal page: just write it directly. */
- if ( ratewrite(io_fd, live, spage, PAGE_SIZE) !=
- PAGE_SIZE )
- {
- ERROR("Error when writing to state file (5)"
- " (errno %d)", errno);
- goto out;
- }
+ /* We have a normal page: accumulate it for writing. */
+ run++;
}
} /* end of the write out for this batch */
+
+ if ( run )
+ {
+ /* write out the last accumulated run of pages */
+ if ( ratewrite(io_fd, live,
+ (char*)region_base+(PAGE_SIZE*(j-run)),
+ PAGE_SIZE*run) != PAGE_SIZE*run )
+ {
+ ERROR("Error when writing to state file (4c)"
+ " (errno %d)", errno);
+ goto out;
+ }
+ }
sent_this_iter += batch;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|