From: Peter Lieven <pl@kamp.de>
To: qemu-devel@nongnu.org
Cc: quintela@redhat.com, Stefan Hajnoczi <stefanha@gmail.com>,
Peter Lieven <pl@kamp.de>, Orit Wasserman <owasserm@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCHv4 5/9] migration: search for zero instead of dup pages
Date: Fri, 22 Mar 2013 13:46:06 +0100 [thread overview]
Message-ID: <1363956370-23681-6-git-send-email-pl@kamp.de> (raw)
In-Reply-To: <1363956370-23681-1-git-send-email-pl@kamp.de>
virtually all dup pages are zero pages. remove
the special is_dup_page() function and use the
optimized buffer_find_nonzero_offset() function
instead.
here buffer_find_nonzero_offset() is used directly
to avoid the unnecssary additional checks in
buffer_is_zero().
raw performace gain checking zeroed memory
over is_dup_page() is approx. 15-20% with SSE2.
Signed-off-by: Peter Lieven <pl@kamp.de>
---
arch_init.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 1b71912..9ebca83 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -144,19 +144,10 @@ int qemu_read_default_config_files(bool userconfig)
return 0;
}
-static int is_dup_page(uint8_t *page)
+static inline bool is_zero_page(uint8_t *p)
{
- VECTYPE *p = (VECTYPE *)page;
- VECTYPE val = SPLAT(page);
- int i;
-
- for (i = 0; i < TARGET_PAGE_SIZE / sizeof(VECTYPE); i++) {
- if (!ALL_EQ(val, p[i])) {
- return 0;
- }
- }
-
- return 1;
+ return buffer_find_nonzero_offset(p, TARGET_PAGE_SIZE) ==
+ TARGET_PAGE_SIZE;
}
/* struct contains XBZRLE cache and a static page
@@ -443,12 +434,12 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
/* In doubt sent page as normal */
bytes_sent = -1;
- if (is_dup_page(p)) {
+ if (is_zero_page(p)) {
acct_info.dup_pages++;
bytes_sent = save_block_hdr(f, block, offset, cont,
RAM_SAVE_FLAG_COMPRESS);
- qemu_put_byte(f, *p);
- bytes_sent += 1;
+ qemu_put_byte(f, 0);
+ bytes_sent++;
} else if (migrate_use_xbzrle()) {
current_addr = block->offset + offset;
bytes_sent = save_xbzrle_page(f, p, current_addr, block,
--
1.7.9.5
next prev parent reply other threads:[~2013-03-22 12:52 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 12:46 [Qemu-devel] [PATCHv4 0/9] buffer_is_zero / migration optimizations Peter Lieven
2013-03-22 12:46 ` [Qemu-devel] [PATCHv4 1/9] move vector definitions to qemu-common.h Peter Lieven
2013-03-25 8:35 ` Orit Wasserman
2013-03-22 12:46 ` [Qemu-devel] [PATCHv4 2/9] cutils: add a function to find non-zero content in a buffer Peter Lieven
2013-03-22 19:37 ` Eric Blake
2013-03-22 20:03 ` Peter Lieven
2013-03-22 20:22 ` [Qemu-devel] indentation hints [was: [PATCHv4 2/9] cutils: add a function to find non-zero content in a buffer] Eric Blake
2013-03-23 11:18 ` Peter Maydell
2013-03-25 8:53 ` [Qemu-devel] [PATCHv4 2/9] cutils: add a function to find non-zero content in a buffer Orit Wasserman
2013-03-25 8:56 ` Peter Lieven
2013-03-25 9:26 ` Orit Wasserman
2013-03-25 9:42 ` Paolo Bonzini
2013-03-25 10:03 ` Orit Wasserman
2013-03-22 12:46 ` [Qemu-devel] [PATCHv4 3/9] buffer_is_zero: use vector optimizations if possible Peter Lieven
2013-03-25 8:53 ` Orit Wasserman
2013-03-22 12:46 ` [Qemu-devel] [PATCHv4 4/9] bitops: use vector algorithm to optimize find_next_bit() Peter Lieven
2013-03-25 9:04 ` Orit Wasserman
2013-03-22 12:46 ` Peter Lieven [this message]
2013-03-22 19:49 ` [Qemu-devel] [PATCHv4 5/9] migration: search for zero instead of dup pages Eric Blake
2013-03-22 20:02 ` Peter Lieven
2013-03-25 9:30 ` Orit Wasserman
2013-03-22 12:46 ` [Qemu-devel] [PATCHv4 6/9] migration: add an indicator for bulk state of ram migration Peter Lieven
2013-03-25 9:32 ` Orit Wasserman
2013-03-22 12:46 ` [Qemu-devel] [PATCHv4 7/9] migration: do not sent zero pages in bulk stage Peter Lieven
2013-03-22 20:13 ` Eric Blake
2013-03-25 9:44 ` Orit Wasserman
2013-03-22 12:46 ` [Qemu-devel] [PATCHv4 8/9] migration: do not search dirty " Peter Lieven
2013-03-25 10:05 ` Orit Wasserman
2013-03-22 12:46 ` [Qemu-devel] [PATCHv4 9/9] migration: use XBZRLE only after " Peter Lieven
2013-03-25 10:16 ` Orit Wasserman
2013-03-22 17:25 ` [Qemu-devel] [PATCHv4 0/9] buffer_is_zero / migration optimizations Paolo Bonzini
2013-03-22 19:20 ` Peter Lieven
2013-03-22 21:24 ` Paolo Bonzini
2013-03-23 7:34 ` Peter Lieven
2013-03-25 10:17 ` Peter Lieven
2013-03-25 10:53 ` Paolo Bonzini
2013-03-25 11:26 ` Peter Lieven
2013-03-25 13:02 ` Paolo Bonzini
2013-03-25 13:23 ` Peter Lieven
2013-03-25 13:32 ` Peter Lieven
2013-03-25 14:34 ` Paolo Bonzini
2013-03-25 21:37 ` Peter Lieven
2013-03-26 8:14 ` Peter Lieven
2013-03-26 9:20 ` Paolo Bonzini
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=1363956370-23681-6-git-send-email-pl@kamp.de \
--to=pl@kamp.de \
--cc=owasserm@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@gmail.com \
/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).