Orit Wasserman <owass...@redhat.com> 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.