|  |  | 
  
    |  |  | 
 
  |   |  | 
  
    |  |  | 
  
    |  |  | 
  
    |   xen-devel
[Xen-devel] [PATCH 06 of 11] Do bitmap scan word-by-word before	bit-by-b 
| # HG changeset patch
# User Brendan Cully <brendan@xxxxxxxxx>
# Date 1240355511 25200
# Node ID ae725eba611ff93dd9a09cfa995f61b6db28cf86
# Parent  d6c00f82239b2527cbdb8cc0140f67d7b168ae20
Do bitmap scan word-by-word before bit-by-bit.
For sparse bitmaps and large domains this saves a lot of time.
Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c
+++ b/tools/libxc/xc_domain_save.c
@@ -94,6 +94,8 @@
 
 #define BITMAP_SHIFT(_nr) ((_nr) % BITS_PER_LONG)
 
+#define ORDER_LONG (sizeof(unsigned long) == 4 ? 5 : 6)
+
 static inline int test_bit (int nr, volatile void * addr)
 {
     return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1;
@@ -1164,6 +1166,14 @@
 
                 if ( completed )
                 {
+                    /* for sparse bitmaps, word-by-word may save time */
+                    if ( !to_send[N >> ORDER_LONG] )
+                    {
+                        /* incremented again in for loop! */
+                        N += BITS_PER_LONG - 1;
+                        continue;
+                    }
+
                     if ( !test_bit(n, to_send) )
                         continue;
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 | 
 
| <Prev in Thread] | Current Thread | [Next in Thread> |  | 
[Xen-devel] [PATCH 00 of 11] Remus 0.9 released!, Brendan Cully
[Xen-devel] [PATCH 07 of 11] Make checkpoint buffering HVM-aware, Brendan Cully
[Xen-devel] [PATCH 03 of 11] Initiate failover if a packet is not	received every 500ms, Brendan Cully
[Xen-devel] [PATCH 01 of 11] Add callbacks for suspend,	postcopy and preresume in xc_domain_save, Brendan Cully
[Xen-devel] [PATCH 06 of 11] Do bitmap scan word-by-word before	bit-by-bit,
Brendan Cully <=
[Xen-devel] [PATCH 10 of 11] Fixup for tap:tapdisk syntax in remus	uname, Brendan Cully
[Xen-devel] [PATCH 04 of 11] Buffer checkpoint data locally until	domain has resumed execution, Brendan Cully
[Xen-devel] [PATCH 02 of 11] Make xc_domain_restore loop until the	fd is closed, Brendan Cully
[Xen-devel] [PATCH 09 of 11] blktap2: only open driver stack once, Brendan Cully
[Xen-devel] [PATCH 08 of 11] blktap2: configurable driver chains, Brendan Cully
[Xen-devel] [PATCH 05 of 11] Do not bother with to_skip/to_fix	bitmaps after the first final round, Brendan Cully
[Xen-devel] [PATCH 11 of 11] blktap2: add remus driver, Brendan Cully
Re: [Xen-devel] [PATCH 00 of 11] Remus 0.9 released!, Keir Fraser
 |  |  | 
  
    |  |  |