From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abQqG-00087m-Ih for qemu-devel@nongnu.org; Thu, 03 Mar 2016 05:50:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abQqF-0006S7-KQ for qemu-devel@nongnu.org; Thu, 03 Mar 2016 05:50:48 -0500 Received: from mga04.intel.com ([192.55.52.120]:50906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abQqF-0006Qc-FL for qemu-devel@nongnu.org; Thu, 03 Mar 2016 05:50:47 -0500 From: Liang Li Date: Thu, 3 Mar 2016 18:44:27 +0800 Message-Id: <1457001868-15949-4-git-send-email-liang.z.li@intel.com> In-Reply-To: <1457001868-15949-1-git-send-email-liang.z.li@intel.com> References: <1457001868-15949-1-git-send-email-liang.z.li@intel.com> Subject: [Qemu-devel] [RFC qemu 3/4] migration: not set migration bitmap in setup stage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: quintela@redhat.com, amit.shah@redhat.com, qemu-devel@nongnu.org, linux-kernel@vger.kernel.org Cc: ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com, Liang Li , dgilbert@redhat.com, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, pbonzini@redhat.com, akpm@linux-foundation.org, rth@twiddle.net Set ram_list.dirty_memory instead of migration bitmap, the migration bitmap will be update when doing migration_bitmap_sync(). Set migration_dirty_pages to 0 and it will be updated by migration_dirty_pages() too. The following patch is based on this change. Signed-off-by: Liang Li --- migration/ram.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 704f6a9..ee2547d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1931,19 +1931,19 @@ static int ram_save_setup(QEMUFile *f, void *opaque) ram_bitmap_pages = last_ram_offset() >> TARGET_PAGE_BITS; migration_bitmap_rcu = g_new0(struct BitmapRcu, 1); migration_bitmap_rcu->bmap = bitmap_new(ram_bitmap_pages); - bitmap_set(migration_bitmap_rcu->bmap, 0, ram_bitmap_pages); if (migrate_postcopy_ram()) { migration_bitmap_rcu->unsentmap = bitmap_new(ram_bitmap_pages); bitmap_set(migration_bitmap_rcu->unsentmap, 0, ram_bitmap_pages); } - /* - * Count the total number of pages used by ram blocks not including any - * gaps due to alignment or unplugs. - */ - migration_dirty_pages = ram_bytes_total() >> TARGET_PAGE_BITS; + migration_dirty_pages = 0; + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { + cpu_physical_memory_set_dirty_range(block->offset, + block->used_length, + DIRTY_MEMORY_MIGRATION); + } memory_global_dirty_log_start(); migration_bitmap_sync(); qemu_mutex_unlock_ramlist(); -- 1.8.3.1