From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRiGa-0003UV-TK for qemu-devel@nongnu.org; Fri, 26 Oct 2012 07:39:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TRiGZ-0005jB-QU for qemu-devel@nongnu.org; Fri, 26 Oct 2012 07:39:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRiGZ-0005j0-IW for qemu-devel@nongnu.org; Fri, 26 Oct 2012 07:39:55 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9QBdsLJ025661 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 26 Oct 2012 07:39:54 -0400 From: Juan Quintela In-Reply-To: <5083F245.5020903@redhat.com> (Orit Wasserman's message of "Sun, 21 Oct 2012 15:01:57 +0200") References: <1350545426-23172-1-git-send-email-quintela@redhat.com> <1350545426-23172-31-git-send-email-quintela@redhat.com> <5083F245.5020903@redhat.com> Date: Fri, 26 Oct 2012 13:39:51 +0200 Message-ID: <87r4olxy0o.fsf@elfo.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 30/30] ram: optimize migration bitmap walking Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Orit Wasserman Cc: qemu-devel@nongnu.org Orit Wasserman wrote: > On 10/18/2012 09:30 AM, Juan Quintela wrote: >> Instead of testing each page individually, we search what is the next >> dirty page with a bitmap operation. We have to reorganize the code to >> move from a "for" loop, to a while(dirty) loop. >> >> >> - do { >> + while(true) { >> mr = block->mr; >> - if (migration_bitmap_test_and_reset_dirty(mr, offset)) { >> + offset = migration_bitmap_find_and_reset_dirty(mr, offset); >> + if (complete_round && block == last_seen_block && >> + offset >= last_offset) { >> + break; >> + } > Juan, > You need to exchange those line, first check to see you did a full round than > calculate and reset the offset, in the way it is written now you may > reset a bit and than break of the loop > without sending it. How? if complete_round == true, it means that we are in the second round. block == last_seen_block means that we are back at the 1st block that we have looked. if offset >= last_offset, there are two options: a- == last_offset: that was the 1st one that we checked, so it can't be true. b- >= last_offset: it means tat we have already passed that bit, it _has_ to be zero, otherwise somebody has changed the bitmap under or foot. Or have I missed something? Notice that at some point we should allow for concurrent dirty of the bitmap, but we need to do yet more things. Later, Juan.