From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXPXs-0002RV-Bc for qemu-devel@nongnu.org; Wed, 10 Aug 2016 05:11:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXPXn-0001TE-AJ for qemu-devel@nongnu.org; Wed, 10 Aug 2016 05:11:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48618) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXPXn-0001Sv-4O for qemu-devel@nongnu.org; Wed, 10 Aug 2016 05:11:23 -0400 From: Juan Quintela In-Reply-To: (Liang Z. Li's message of "Wed, 10 Aug 2016 05:04:31 +0000") References: <20160809191216.GF2025@work-vm> <1470790447-83284-1-git-send-email-jiangshanlai@gmail.com> Reply-To: quintela@redhat.com Date: Wed, 10 Aug 2016 11:11:17 +0200 Message-ID: <877fbpouoa.fsf@emacs.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH V2] add migration capability to bypass the shared memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Li, Liang Z" Cc: Lai Jiangshan , "qemu-devel@nongnu.org" , Peter Crosthwaite , Markus Armbruster , Amit Shah , Paolo Bonzini , Richard Henderson "Li, Liang Z" wrote: >> On Wed, Aug 10, 2016 at 10:22 AM, Li, Liang Z wrote: >> > Hi Jiangshan, >> > >> > Glad to see your patch. It's a simple implementation which could provide >> very useful functions. >> > >> >> +static void migration_bitmap_init(unsigned long *bitmap) { >> >> + RAMBlock *block; >> >> + >> >> + bitmap_clear(bitmap, 0, last_ram_offset() >> TARGET_PAGE_BITS); >> >> + rcu_read_lock(); >> >> + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { >> >> + if (!migrate_bypass_shared_memory() >> >> || !qemu_ram_is_shared(block)) { >> >> + bitmap_set(bitmap, block->offset >> TARGET_PAGE_BITS, >> > >> > You should use (block->offset >> TARGET_PAGE_BITS )/ BITS_PER_LONG >> here. >> >> Hello, Li >> >> I might have missed something, could you tell me more? >> >> void bitmap_set(unsigned long *map, long start, long nr); I think the @start >> and @nr are both the number of the bits. >> >> thanks, >> Lai > > You are right, I have make a mistake by checking the code. Sorry for the noise. > > BTW. Is it possible to bypass the shared block in the 'ram_find_and_save_block'? > I mean no to check if a page is dirty for a shared block, it may make things faster. Nice spotted. That would make things faster. But once there we could split the bitmap by ramblock, and the migration_dirty_pages also per block, that would make all the searchs faster, and adding/removing blocks of ram much easier. If we enter optimizing that function, we could really do much better that the "again" parameter that we have right now. Later, Juan.