kvm_vm_ioctl_get_dirty_log scans bitmap to see it it's all zero, but
doesn't use that information.

Avi says:
        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.

It's pretty simple: if the bitmap is all zero, we don't need to do anything to
clean it.

Signed-off-by: Rusty Russell <[EMAIL PROTECTED]>

diff -r 66566cf6b576 drivers/kvm/kvm_main.c
--- a/drivers/kvm/kvm_main.c    Fri Jul 27 16:27:11 2007 +1000
+++ b/drivers/kvm/kvm_main.c    Mon Jul 30 23:15:47 2007 +1000
@@ -838,11 +838,13 @@ static int kvm_vm_ioctl_get_dirty_log(st
        if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n))
                goto out;
 
-       spin_lock(&kvm->lock);
-       kvm_mmu_slot_remove_write_access(kvm, log->slot);
-       kvm_flush_remote_tlbs(kvm);
-       memset(memslot->dirty_bitmap, 0, n);
-       spin_unlock(&kvm->lock);
+       if (any) {
+               spin_lock(&kvm->lock);
+               kvm_mmu_slot_remove_write_access(kvm, log->slot);
+               kvm_flush_remote_tlbs(kvm);
+               memset(memslot->dirty_bitmap, 0, n);
+               spin_unlock(&kvm->lock);
+       }
 
        r = 0;
 



-------------------------------------------------------------------------
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/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to