[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Remus: Do bitmap scan word-by-word before bit-by-bit.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1257794242 0
# Node ID 01c9cb566f61f143870600b30857562963aaee27
# Parent  dc0360d981e73f7bafee5b810743ae28c03b9680
Remus: 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>
---
 tools/libxc/xc_domain_save.c |   10 ++++++++++
 1 files changed, 10 insertions(+)

diff -r dc0360d981e7 -r 01c9cb566f61 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c      Mon Nov 09 19:16:48 2009 +0000
+++ b/tools/libxc/xc_domain_save.c      Mon Nov 09 19:17:22 2009 +0000
@@ -93,6 +93,8 @@ struct outbuf {
    ((volatile unsigned long *)(_bmap))[(_nr)/BITS_PER_LONG]
 
 #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)
 {
@@ -1164,6 +1166,14 @@ int xc_domain_save(int xc_handle, int io
 
                 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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.