From: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
To: Avi Kivity <avi@redhat.com>
Cc: ohmura.kei@lab.ntt.co.jp, mtosatti@redhat.com,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] Re: [PATCH] qemu-kvm: Speed up of the dirty-bitmap-traveling
Date: Tue, 09 Feb 2010 18:54:49 +0900 [thread overview]
Message-ID: <4B7130E9.7060809@lab.ntt.co.jp> (raw)
In-Reply-To: <4B70065B.1010401@redhat.com>
Thank you for your comments. We have implemented the code which applied your
comments. This is patch for qemu-kvm.c.
Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
---
qemu-kvm.c | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/qemu-kvm.c b/qemu-kvm.c
index a305907..d7474ea 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -2438,27 +2438,34 @@ static int kvm_get_dirty_pages_log_range(unsigned long start_addr,
unsigned long offset,
unsigned long mem_size)
{
- unsigned int i, j, n = 0;
+ unsigned int i, j, k, start, end;
unsigned char c;
unsigned long page_number, addr, addr1;
ram_addr_t ram_addr;
- unsigned int len = ((mem_size / TARGET_PAGE_SIZE) + 7) / 8;
+ unsigned int len = ((mem_size / TARGET_PAGE_SIZE) + TARGET_LONG_BITS - 1) /
+ TARGET_LONG_BITS;
+ unsigned long *bitmap_ul = (unsigned long *)bitmap;
/*
* bitmap-traveling is faster than memory-traveling (for addr...)
* especially when most of the memory is not dirty.
*/
for (i = 0; i < len; i++) {
- c = bitmap[i];
- while (c > 0) {
- j = ffsl(c) - 1;
- c &= ~(1u << j);
- page_number = i * 8 + j;
- addr1 = page_number * TARGET_PAGE_SIZE;
- addr = offset + addr1;
- ram_addr = cpu_get_physical_page_desc(addr);
- cpu_physical_memory_set_dirty(ram_addr);
- n++;
+ if (bitmap_ul[i] != 0) {
+ start = i * TARGET_LONG_SIZE;
+ end = (i + 1) * TARGET_LONG_SIZE;
+ for (j = start; j < end; j++) {
+ c = bitmap[j];
+ while (c > 0) {
+ k = ffsl(c) - 1;
+ c &= ~(1u << k);
+ page_number = j * 8 + k;
+ addr1 = page_number * TARGET_PAGE_SIZE;
+ addr = offset + addr1;
+ ram_addr = cpu_get_physical_page_desc(addr);
+ cpu_physical_memory_set_dirty(ram_addr);
+ }
+ }
}
}
return 0;
--
1.6.3.3
next prev parent reply other threads:[~2010-02-09 9:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-05 10:18 [Qemu-devel] [PATCH] qemu-kvm: Speed up of the dirty-bitmap-traveling OHMURA Kei
2010-02-05 12:04 ` [Qemu-devel] " Jan Kiszka
2010-02-08 6:14 ` OHMURA Kei
2010-02-08 11:23 ` OHMURA Kei
2010-02-08 11:44 ` Jan Kiszka
2010-02-09 9:55 ` OHMURA Kei
2010-02-08 12:40 ` Avi Kivity
2010-02-09 9:54 ` OHMURA Kei [this message]
2010-02-09 10:26 ` Avi Kivity
2010-02-10 9:55 ` OHMURA Kei
2010-02-10 10:24 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B7130E9.7060809@lab.ntt.co.jp \
--to=ohmura.kei@lab.ntt.co.jp \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).