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-changelog

[Xen-changelog] [xen-unstable] save/restore: Permute saved memory with 2

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] save/restore: Permute saved memory with 2MB chunk size.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 Mar 2008 05:40:57 -0700
Delivery-date: Thu, 20 Mar 2008 05:45:04 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1205869003 0
# Node ID c40a5ae3e18b4b1ab1debaf8144ff17ed6c6e095
# Parent  df89656a4b949e99c59d684f291212c8e29c9b19
save/restore: Permute saved memory with 2MB chunk size.

The memory permutation cause a slow down in case of a save/restore
(bug 1143). It works better when the mixing is done with 2MB chunks.

Signed-off-by: Jean Guyader <jean.guyader@xxxxxxxxxxxxx>
---
 tools/libxc/xc_domain_save.c |   34 +++++++++++-----------------------
 1 files changed, 11 insertions(+), 23 deletions(-)

diff -r df89656a4b94 -r c40a5ae3e18b tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c      Tue Mar 18 19:28:09 2008 +0000
+++ b/tools/libxc/xc_domain_save.c      Tue Mar 18 19:36:43 2008 +0000
@@ -125,34 +125,22 @@ static inline int count_bits ( int nr, v
     return count;
 }
 
-static inline int permute( int i, int nr, int order_nr  )
+static inline int permute(unsigned long i, unsigned long order_nr)
 {
     /* Need a simple permutation function so that we scan pages in a
        pseudo random order, enabling us to get a better estimate of
        the domain's page dirtying rate as we go (there are often
        contiguous ranges of pfns that have similar behaviour, and we
        want to mix them up. */
-
-    /* e.g. nr->oder 15->4 16->4 17->5 */
-    /* 512MB domain, 128k pages, order 17 */
-
-    /*
-      QPONMLKJIHGFEDCBA
-             QPONMLKJIH
-      GFEDCBA
-     */
-
-    /*
-      QPONMLKJIHGFEDCBA
-                  EDCBA
-             QPONM
-      LKJIHGF
-      */
-
-    do { i = ((i>>(order_nr-10)) | ( i<<10 ) ) & ((1<<order_nr)-1); }
-    while ( i >= nr ); /* this won't ever loop if nr is a power of 2 */
-
-    return i;
+  
+  unsigned char keep = 9; /* chunk of 2 MB */
+  unsigned char shift_low = (order_nr - keep) / 2 + ((order_nr - keep) / 2) % 
2;
+  unsigned char shift_high = order_nr - keep - shift_low;
+
+  unsigned long high = (i >> (keep + shift_low));
+  unsigned long low = (i >> keep) & ((1 << shift_low) - 1);
+
+  return (i & ((1 << keep) - 1)) | (low << (shift_high + keep)) | (high << 
keep);
 }
 
 static uint64_t tv_to_us(struct timeval *new)
@@ -1126,7 +1114,7 @@ int xc_domain_save(int xc_handle, int io
                    (batch < MAX_BATCH_SIZE) && (N < p2m_size);
                    N++ )
             {
-                int n = permute(N, p2m_size, order_nr);
+                int n = permute(N, order_nr);
 
                 if ( debug )
                 {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] save/restore: Permute saved memory with 2MB chunk size., Xen patchbot-unstable <=