Received: from eggs.gnu.org ([2001:4830:134:3::10]:35348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCPJ7-0000Tb-Bo for qemu-devel@nongnu.org; Mon, 13 Jun 2016 06:41:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCPJ6-00079h-88 for qemu-devel@nongnu.org; Mon, 13 Jun 2016 06:41:25 -0400 From: Date: Mon, 13 Jun 2016 14:38:32 +0530 Message-ID: <1465808915-4887-2-git-send-email-vijayak@caviumnetworks.com> In-Reply-To: <1465808915-4887-1-git-send-email-vijayak@caviumnetworks.com> References: <1465808915-4887-1-git-send-email-vijayak@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [RFC PATCH v1 1/4] migration: Remove static allocation of xzblre cache buffer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-arm@nongnu.org, peter.maydell@linaro.org, pbonzini@redhat.com, quintela@redhat.com Cc: qemu-devel@nongnu.org, Prasun.Kapoor@caviumnetworks.com, vijay.kilari@gmail.com, Vijaya Kumar K , Vijaya Kumar K From: Vijaya Kumar K Allocate xzblre zero page cache buffer dynamically. Remove dependency on TARGET_PAGE_SIZE to make run-time page size detection for arm platforms. Signed-off-by: Vijaya Kumar K --- migration/ram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 844ea46..ba3b352 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -69,7 +69,7 @@ static uint64_t bitmap_sync_count; /* 0x80 is reserved in migration.h start with 0x100 next */ #define RAM_SAVE_FLAG_COMPRESS_PAGE 0x100 -static const uint8_t ZERO_TARGET_PAGE[TARGET_PAGE_SIZE]; +static uint8_t *ZERO_TARGET_PAGE; static inline bool is_zero_range(uint8_t *p, uint64_t size) { @@ -1437,6 +1437,7 @@ static void ram_migration_cleanup(void *opaque) cache_fini(XBZRLE.cache); g_free(XBZRLE.encoded_buf); g_free(XBZRLE.current_buf); + g_free(ZERO_TARGET_PAGE); XBZRLE.cache = NULL; XBZRLE.encoded_buf = NULL; XBZRLE.current_buf = NULL; @@ -1893,6 +1894,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) if (migrate_use_xbzrle()) { XBZRLE_cache_lock(); + ZERO_TARGET_PAGE = g_malloc0(TARGET_PAGE_SIZE); XBZRLE.cache = cache_init(migrate_xbzrle_cache_size() / TARGET_PAGE_SIZE, TARGET_PAGE_SIZE); -- 1.7.9.5