From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPXor-0006vk-Uh for qemu-devel@nongnu.org; Wed, 02 May 2012 07:34:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPXon-0000xe-56 for qemu-devel@nongnu.org; Wed, 02 May 2012 07:34:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPXom-0000vX-TA for qemu-devel@nongnu.org; Wed, 02 May 2012 07:34:01 -0400 Message-ID: <4FA11BA3.2000605@redhat.com> Date: Wed, 02 May 2012 14:33:55 +0300 From: Avi Kivity MIME-Version: 1.0 References: <20120428190544.7dc2bfd281054c1fcac5a14e@gmail.com> <20120502202414.37d760fbb1135bb8acb0f0db@gmail.com> In-Reply-To: <20120502202414.37d760fbb1135bb8acb0f0db@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Heavy memory_region_get_dirty() -- Re: [PATCH 0/1 v2] KVM: Alleviate mmu_lock contention during dirty logging List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Takuya Yoshikawa Cc: yoshikawa.takuya@oss.ntt.co.jp, mtosatti@redhat.com, qemu-devel , kvm@vger.kernel.org On 05/02/2012 02:24 PM, Takuya Yoshikawa wrote: > During checking mmu_lock contention, I noticed that QEMU's > memory_region_get_dirty() was using unexpectedly much CPU time. > > Thanks, > Takuya > > ============================= > perf top -t ${QEMU_TID} > ============================= > 51.52% qemu-system-x86_64 [.] memory_region_get_dirty > 16.73% qemu-system-x86_64 [.] ram_save_remaining > memory_region_get_dirty() is called from ram_save_remaining(). Looks like quadratic behaviour here: we send a few pages in ram_save_remaining(), then walk the entire dirty bitmap to calculate expected_time(). We should probably calculate expected_time once per iteration. -- error compiling committee.c: too many arguments to function