From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGRYV-00041q-L5 for qemu-devel@nongnu.org; Tue, 25 Sep 2012 05:35:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGRYM-0001CR-9d for qemu-devel@nongnu.org; Tue, 25 Sep 2012 05:35:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39431) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGRYL-0001BR-Oj for qemu-devel@nongnu.org; Tue, 25 Sep 2012 05:35:42 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8P9ZeK9002352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 25 Sep 2012 05:35:40 -0400 Message-ID: <50617AF1.10209@redhat.com> Date: Tue, 25 Sep 2012 11:35:45 +0200 From: Orit Wasserman MIME-Version: 1.0 References: <1348217255-22441-1-git-send-email-quintela@redhat.com> <1348217255-22441-11-git-send-email-quintela@redhat.com> In-Reply-To: <1348217255-22441-11-git-send-email-quintela@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 10/41] ram: Introduce migration_bitmap_test_and_reset_dirty() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org On 09/21/2012 11:47 AM, Juan Quintela wrote: > It just test if the dirty bit is set, and clears it. > > Signed-off-by: Juan Quintela > --- > arch_init.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/arch_init.c b/arch_init.c > index b2dcc24..acc057f 100644 > --- a/arch_init.c > +++ b/arch_init.c > @@ -332,6 +332,19 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data, > static RAMBlock *last_block; > static ram_addr_t last_offset; > > +static inline bool migration_bitmap_test_and_reset_dirty(MemoryRegion *mr, > + ram_addr_t offset) > +{ > + bool ret = memory_region_get_dirty(mr, offset, TARGET_PAGE_SIZE, > + DIRTY_MEMORY_MIGRATION); > + > + if (ret) { > + memory_region_reset_dirty(mr, offset, TARGET_PAGE_SIZE, > + DIRTY_MEMORY_MIGRATION); > + } > + return ret; > +} > + > static inline void migration_bitmap_set_dirty(MemoryRegion *mr, int length) > { > ram_addr_t addr; > @@ -365,14 +378,10 @@ static int ram_save_block(QEMUFile *f, bool last_stage) > > do { > mr = block->mr; > - if (memory_region_get_dirty(mr, offset, TARGET_PAGE_SIZE, > - DIRTY_MEMORY_MIGRATION)) { > + if (migration_bitmap_test_and_reset_dirty(mr, offset)) { > uint8_t *p; > int cont = (block == last_block) ? RAM_SAVE_FLAG_CONTINUE : 0; > > - memory_region_reset_dirty(mr, offset, TARGET_PAGE_SIZE, > - DIRTY_MEMORY_MIGRATION); > - > p = memory_region_get_ram_ptr(mr) + offset; > > if (is_dup_page(p)) { > Reviewed-by: Orit Wasserman