|
|
0a122b |
From c964e085dac5d2e47974f1275a0557ec841aeaba Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
Message-Id: <c964e085dac5d2e47974f1275a0557ec841aeaba.1387382496.git.minovotn@redhat.com>
|
|
|
0a122b |
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
0a122b |
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
0a122b |
From: Nigel Croxon <ncroxon@redhat.com>
|
|
|
0a122b |
Date: Thu, 14 Nov 2013 22:53:15 +0100
|
|
|
0a122b |
Subject: [PATCH 39/46] arch_init: make is_zero_page accept size
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Nigel Croxon <ncroxon@redhat.com>
|
|
|
0a122b |
Message-id: <1384469598-13137-40-git-send-email-ncroxon@redhat.com>
|
|
|
0a122b |
Patchwork-id: 55717
|
|
|
0a122b |
O-Subject: [RHEL7.0 PATCH 39/42] arch_init: make is_zero_page accept size
|
|
|
0a122b |
Bugzilla: 1011720
|
|
|
0a122b |
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
Bugzilla: 1011720
|
|
|
0a122b |
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
|
|
|
0a122b |
|
|
|
0a122b |
>From commit ID:
|
|
|
0a122b |
commit dc3c26a479e5bd19c1b3c04f696b8f70ad57f0b7
|
|
|
0a122b |
Author: Isaku Yamahata <yamahata@private.email.ne.jp>
|
|
|
0a122b |
Date: Sat Sep 21 01:23:36 2013 +0900
|
|
|
0a122b |
|
|
|
0a122b |
arch_init: make is_zero_page accept size
|
|
|
0a122b |
|
|
|
0a122b |
Later is_zero_page will be used for non TARGET_PAGE_SIZE
|
|
|
0a122b |
range.
|
|
|
0a122b |
And rename it to is_zero_range as it isn't page size any more.
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
|
|
|
0a122b |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
arch_init.c | 9 ++++-----
|
|
|
0a122b |
1 files changed, 4 insertions(+), 5 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
arch_init.c | 9 ++++-----
|
|
|
0a122b |
1 file changed, 4 insertions(+), 5 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/arch_init.c b/arch_init.c
|
|
|
0a122b |
index 26d0374..5ce9c61 100644
|
|
|
0a122b |
--- a/arch_init.c
|
|
|
0a122b |
+++ b/arch_init.c
|
|
|
0a122b |
@@ -150,10 +150,9 @@ int qemu_read_default_config_files(bool userconfig)
|
|
|
0a122b |
return 0;
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-static inline bool is_zero_page(uint8_t *p)
|
|
|
0a122b |
+static inline bool is_zero_range(uint8_t *p, uint64_t size)
|
|
|
0a122b |
{
|
|
|
0a122b |
- return buffer_find_nonzero_offset(p, TARGET_PAGE_SIZE) ==
|
|
|
0a122b |
- TARGET_PAGE_SIZE;
|
|
|
0a122b |
+ return buffer_find_nonzero_offset(p, size) == size;
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
/* struct contains XBZRLE cache and a static page
|
|
|
0a122b |
@@ -497,7 +496,7 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
|
|
|
0a122b |
acct_info.dup_pages++;
|
|
|
0a122b |
}
|
|
|
0a122b |
}
|
|
|
0a122b |
- } else if (is_zero_page(p)) {
|
|
|
0a122b |
+ } else if (is_zero_range(p, TARGET_PAGE_SIZE)) {
|
|
|
0a122b |
acct_info.dup_pages++;
|
|
|
0a122b |
bytes_sent = save_block_hdr(f, block, offset, cont,
|
|
|
0a122b |
RAM_SAVE_FLAG_COMPRESS);
|
|
|
0a122b |
@@ -849,7 +848,7 @@ static inline void *host_from_stream_offset(QEMUFile *f,
|
|
|
0a122b |
*/
|
|
|
0a122b |
void ram_handle_compressed(void *host, uint8_t ch, uint64_t size)
|
|
|
0a122b |
{
|
|
|
0a122b |
- if (ch != 0 || !is_zero_page(host)) {
|
|
|
0a122b |
+ if (ch != 0 || !is_zero_range(host, TARGET_PAGE_SIZE)) {
|
|
|
0a122b |
memset(host, ch, size);
|
|
|
0a122b |
#ifndef _WIN32
|
|
|
0a122b |
if (ch == 0 &&
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.11.7
|
|
|
0a122b |
|