From nobody Mon Feb 9 19:42:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496829832746281.02006582864703; Wed, 7 Jun 2017 03:03:52 -0700 (PDT) Received: from localhost ([::1]:42402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIXoc-0000mm-Ox for importer@patchew.org; Wed, 07 Jun 2017 06:03:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIXkZ-0005X2-K5 for qemu-devel@nongnu.org; Wed, 07 Jun 2017 05:59:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIXkY-0005Kx-PQ for qemu-devel@nongnu.org; Wed, 07 Jun 2017 05:59:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60192) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIXkY-0005Kq-JW for qemu-devel@nongnu.org; Wed, 07 Jun 2017 05:59:38 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 855B161D16 for ; Wed, 7 Jun 2017 09:59:37 +0000 (UTC) Received: from secure.mitica (ovpn-117-154.ams2.redhat.com [10.36.117.154]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6B0717A7B; Wed, 7 Jun 2017 09:59:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 855B161D16 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 855B161D16 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 7 Jun 2017 11:59:23 +0200 Message-Id: <20170607095926.1834-5-quintela@redhat.com> In-Reply-To: <20170607095926.1834-1-quintela@redhat.com> References: <20170607095926.1834-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 07 Jun 2017 09:59:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/7] ram: Move ZERO_TARGET_PAGE inside XBZRLE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It was only used by XBZRLE anyways. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- migration/ram.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 701a1e6..ac30e9e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -69,8 +69,6 @@ /* 0x80 is reserved in migration.h start with 0x100 next */ #define RAM_SAVE_FLAG_COMPRESS_PAGE 0x100 =20 -static uint8_t *ZERO_TARGET_PAGE; - static inline bool is_zero_range(uint8_t *p, uint64_t size) { return buffer_is_zero(p, size); @@ -86,6 +84,8 @@ static struct { /* Cache for XBZRLE, Protected by lock. */ PageCache *cache; QemuMutex lock; + /* it will store a page full of zeros */ + uint8_t *zero_target_page; } XBZRLE; =20 /* buffer used for XBZRLE decoding */ @@ -512,7 +512,7 @@ static void xbzrle_cache_zero_page(RAMState *rs, ram_ad= dr_t current_addr) =20 /* We don't care if this fails to allocate a new cache page * as long as it updated an old one */ - cache_insert(XBZRLE.cache, current_addr, ZERO_TARGET_PAGE, + cache_insert(XBZRLE.cache, current_addr, XBZRLE.zero_target_page, rs->bitmap_sync_count); } =20 @@ -1456,10 +1456,11 @@ 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); + g_free(XBZRLE.zero_target_page); XBZRLE.cache =3D NULL; XBZRLE.encoded_buf =3D NULL; XBZRLE.current_buf =3D NULL; + XBZRLE.zero_target_page =3D NULL; } XBZRLE_cache_unlock(); migration_page_queue_free(rs); @@ -1880,7 +1881,7 @@ static int ram_state_init(RAMState *rs) =20 if (migrate_use_xbzrle()) { XBZRLE_cache_lock(); - ZERO_TARGET_PAGE =3D g_malloc0(TARGET_PAGE_SIZE); + XBZRLE.zero_target_page =3D g_malloc0(TARGET_PAGE_SIZE); XBZRLE.cache =3D cache_init(migrate_xbzrle_cache_size() / TARGET_PAGE_SIZE, TARGET_PAGE_SIZE); --=20 2.9.4