From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvMCK-0007Ql-Ho for qemu-devel@nongnu.org; Fri, 13 Jun 2014 03:46:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvMCE-0006c4-CU for qemu-devel@nongnu.org; Fri, 13 Jun 2014 03:46:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvMCE-0006aT-4F for qemu-devel@nongnu.org; Fri, 13 Jun 2014 03:46:46 -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 s5D7khpT013414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 13 Jun 2014 03:46:44 -0400 Message-ID: <539AAC5E.7030808@redhat.com> Date: Fri, 13 Jun 2014 09:46:38 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1402641281-20382-1-git-send-email-famz@redhat.com> In-Reply-To: <1402641281-20382-1-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] memory: Don't call memory_region_update_coalesced_range if nothing changed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: stefanha@redhat.com Il 13/06/2014 08:34, Fam Zheng ha scritto: > With huge number of PCI devices in the system (for example, 200 > virtio-blk-pci), this unconditional call can slow down emulation of > irrelevant PCI operations drastically, such as a BAR update on a device > that has no coalescing region. So avoid it. > > Signed-off-by: Fam Zheng > --- > memory.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/memory.c b/memory.c > index d8ea212..57227f4 100644 > --- a/memory.c > +++ b/memory.c > @@ -1324,6 +1324,7 @@ void memory_region_add_coalescing(MemoryRegion *mr, > void memory_region_clear_coalescing(MemoryRegion *mr) > { > CoalescedMemoryRange *cmr; > + bool updated = false; > > qemu_flush_coalesced_mmio_buffer(); > mr->flush_coalesced_mmio = false; > @@ -1332,8 +1333,12 @@ void memory_region_clear_coalescing(MemoryRegion *mr) > cmr = QTAILQ_FIRST(&mr->coalesced); > QTAILQ_REMOVE(&mr->coalesced, cmr, link); > g_free(cmr); > + updated = true; > + } > + > + if (updated) { > + memory_region_update_coalesced_range(mr); > } > - memory_region_update_coalesced_range(mr); > } > > void memory_region_set_flush_coalesced(MemoryRegion *mr) > Very nice. Applying to memory branch, thank you. Paolo