Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757280AbcCDCcH (ORCPT ); Thu, 3 Mar 2016 21:32:07 -0500 Received: from mga09.intel.com ([134.134.136.24]:61177 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794AbcCDCcF convert rfc822-to-8bit (ORCPT ); Thu, 3 Mar 2016 21:32:05 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,534,1449561600"; d="scan'208";a="59545807" From: "Li, Liang Z" To: Cornelia Huck CC: "quintela@redhat.com" , "amit.shah@redhat.com" , "qemu-devel@nongnu.org" , "linux-kernel@vger.kernel.org" , "mst@redhat.com" , "akpm@linux-foundation.org" , "pbonzini@redhat.com" , "rth@twiddle.net" , "ehabkost@redhat.com" , "linux-mm@kvack.org" , "virtualization@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "dgilbert@redhat.com" Subject: RE: [RFC qemu 4/4] migration: filter out guest's free pages in ram bulk stage Thread-Topic: [RFC qemu 4/4] migration: filter out guest's free pages in ram bulk stage Thread-Index: AQHRdTqQQsFM+srMq0e7r7ok87aiJ59HHGYAgAF03+A= Date: Fri, 4 Mar 2016 02:32:00 +0000 Message-ID: References: <1457001868-15949-1-git-send-email-liang.z.li@intel.com> <1457001868-15949-5-git-send-email-liang.z.li@intel.com> <20160303131616.753f1de5.cornelia.huck@de.ibm.com> In-Reply-To: <20160303131616.753f1de5.cornelia.huck@de.ibm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTI0MGNjMTYtN2UyNy00ZjVkLTlkYmUtMzQ2NTlhZDRiNzBlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImhFOXZQZmxXMFwvK3YzZEJTVmVkTWJRRjJneWNTMnpNRHNOb0Voc29GRis4PSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1777 Lines: 48 > On Thu, 3 Mar 2016 18:44:28 +0800 > Liang Li wrote: > > > Get the free pages information through virtio and filter out the free > > pages in the ram bulk stage. This can significantly reduce the total > > live migration time as well as network traffic. > > > > Signed-off-by: Liang Li > > --- > > migration/ram.c | 52 > > ++++++++++++++++++++++++++++++++++++++++++++++------ > > 1 file changed, 46 insertions(+), 6 deletions(-) > > > > > @@ -1945,6 +1971,20 @@ static int ram_save_setup(QEMUFile *f, void > *opaque) > > DIRTY_MEMORY_MIGRATION); > > } > > memory_global_dirty_log_start(); > > + > > + if (balloon_free_pages_support() && > > + balloon_get_free_pages(migration_bitmap_rcu->free_pages_bmap, > > + &free_pages_count) == 0) { > > + qemu_mutex_unlock_iothread(); > > + while (balloon_get_free_pages(migration_bitmap_rcu- > >free_pages_bmap, > > + &free_pages_count) == 0) { > > + usleep(1000); > > + } > > + qemu_mutex_lock_iothread(); > > + > > + > > + filter_out_guest_free_pages(migration_bitmap_rcu- > >free_pages_bmap); > > A general comment: Using the ballooner to get information about pages that > can be filtered out is too limited (there may be other ways to do this; we > might be able to use cmma on s390, for example), and I don't like hardcoding > to a specific method. > > What about the reverse approach: Code may register a handler that > populates the free_pages_bitmap which is called during this stage? Good suggestion, thanks! Liang > >