From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] kvm_vm_ioctl_get_dirty_log doesn't need any, probably doesn't want any Date: Mon, 30 Jul 2007 15:39:50 +0300 Message-ID: <46ADDC16.2090801@qumranet.com> References: <1185798696.6131.44.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Rusty Russell Return-path: In-Reply-To: <1185798696.6131.44.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Rusty Russell wrote: > I'm not sure what "any" was for: some optimization which got trimmed, > I imagine. But neither "any" nor "i" are used later in the function, > so I've excised it. > > Looks like it was used to guard kvm_mmu_slot_remove_write_access(); optimizing the case where the guest just leaves the screen alone (which it usually does, especially in benchmarks). I'd rather reinstate that optimization. See 66d8a4e4d4bd470216028daabb9d887b73259c96 where the damage was done. > Signed-off-by: Rusty Russell > > diff -r a17d7fe2b240 drivers/kvm/kvm_main.c > --- a/drivers/kvm/kvm_main.c Mon Jul 30 15:10:22 2007 +1000 > +++ b/drivers/kvm/kvm_main.c Mon Jul 30 15:20:33 2007 +1000 > @@ -830,9 +830,7 @@ static int kvm_vm_ioctl_get_dirty_log(st > struct kvm_dirty_log *log) > { > struct kvm_memory_slot *memslot; > - int r, i; > - int n; > - unsigned long any = 0; > + int r, n; > > spin_lock(&kvm->lock); > > @@ -851,11 +849,7 @@ static int kvm_vm_ioctl_get_dirty_log(st > if (!memslot->dirty_bitmap) > goto out; > > - n = ALIGN(memslot->npages, BITS_PER_LONG) / 8; > - > - for (i = 0; !any && i < n/sizeof(long); ++i) > - any = memslot->dirty_bitmap[i]; > - > + n = BITS_TO_LONGS(memslot->npages) * sizeof(long); > r = -EFAULT; > if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n)) > goto out; > > > -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/