From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfP0q-0008KJ-JQ for qemu-devel@nongnu.org; Fri, 25 Sep 2015 05:09:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfP0p-0003d2-Gb for qemu-devel@nongnu.org; Fri, 25 Sep 2015 05:09:52 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:23745 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfP0p-0003cu-4E for qemu-devel@nongnu.org; Fri, 25 Sep 2015 05:09:51 -0400 From: "Denis V. Lunev" Date: Fri, 25 Sep 2015 12:09:39 +0300 Message-Id: <1443172180-1005-2-git-send-email-den@openvz.org> In-Reply-To: <1443172180-1005-1-git-send-email-den@openvz.org> References: <56050489.9010306@cn.fujitsu.com> <1443172180-1005-1-git-send-email-den@openvz.org> Subject: [Qemu-devel] [PATCH 1/2] migration: bitmap_set is unnecessary as bitmap_new uses g_try_malloc0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Redko , Juan Quintela , Anna Melekhova , qemu-devel@nongnu.org, Amit Shah , "Denis V. Lunev" we can omit calling of bitmap_set in migration_bitmap_extend and ram_save_setup just after bitmap_new, which properly zeroes memory inside. Signed-off-by: Denis V. Lunev CC: Igor Redko CC: Anna Melekhova CC: Juan Quintela CC: Amit Shah CC: Wen Congyang --- migration/ram.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 7f007e6..a712c68 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1081,7 +1081,6 @@ void migration_bitmap_extend(ram_addr_t old, ram_addr_t new) */ qemu_mutex_lock(&migration_bitmap_mutex); bitmap_copy(bitmap, old_bitmap, old); - bitmap_set(bitmap, old, new - old); atomic_rcu_set(&migration_bitmap, bitmap); qemu_mutex_unlock(&migration_bitmap_mutex); migration_dirty_pages += new - old; @@ -1146,7 +1145,6 @@ static int ram_save_setup(QEMUFile *f, void *opaque) ram_bitmap_pages = last_ram_offset() >> TARGET_PAGE_BITS; migration_bitmap = bitmap_new(ram_bitmap_pages); - bitmap_set(migration_bitmap, 0, ram_bitmap_pages); /* * Count the total number of pages used by ram blocks not including any -- 2.1.4