From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC PATCH 1/2] KVM: count the number of dirty bits for each memslot Date: Thu, 18 Nov 2010 15:14:18 +0200 Message-ID: <4CE526AA.8070705@redhat.com> References: <20101118141232.d1d25679.yoshikawa.takuya@oss.ntt.co.jp> <20101118141407.265ec727.yoshikawa.takuya@oss.ntt.co.jp> <4CE521FF.5010509@redhat.com> <4CE525BC.7020906@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Takuya Yoshikawa , mtosatti@redhat.com, laijs@cn.fujitsu.com, kvm@vger.kernel.org, takuya.yoshikawa@gmail.com To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:36407 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757585Ab0KRNOb (ORCPT ); Thu, 18 Nov 2010 08:14:31 -0500 In-Reply-To: <4CE525BC.7020906@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/18/2010 03:10 PM, Jan Kiszka wrote: > Am 18.11.2010 13:54, Avi Kivity wrote: > > On 11/18/2010 07:14 AM, Takuya Yoshikawa wrote: > >> This patch introduces the counter to hold the number of dirty bits in > >> each > >> memslot. We will use this to optimize dirty logging later. > >> > >> > >> @@ -3217,11 +3216,8 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, > >> > >> n = kvm_dirty_bitmap_bytes(memslot); > >> > >> - for (i = 0; !is_dirty&& i< n/sizeof(long); i++) > >> - is_dirty = memslot->dirty_bitmap[i]; > >> - > > > > This can already be an improvement. > > /Me wonders if it wouldn't make sense to expand this optimization to the > user space interface as well, i.e. signaling "there are no dirty pages" > via some flag instead of writing zeros in a bitmap. Of course, this > means supporting both interfaces for a longer period. An 8MB framebuffer is 2K bits, or 256 bytes wide. Comparing 256 cache hot bytes against zero is not worth a new interface. Larger memory slots are very unlikely to be always unmodified. -- error compiling committee.c: too many arguments to function