KVM: Remove unused dirty_bitmap_head and nr_dirty_pages
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Thu, 1 Mar 2012 10:34:45 +0000 (19:34 +0900)
committerAvi Kivity <avi@redhat.com>
Sun, 8 Apr 2012 09:50:01 +0000 (12:50 +0300)
Now that we do neither double buffering nor heuristic selection of the
write protection method these are not needed anymore.

Note: some drivers have their own implementation of set_bit_le() and
making it generic needs a bit of work; so we use test_and_set_bit_le()
and will later replace it with generic set_bit_le().

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
include/linux/kvm_host.h
virt/kvm/kvm_main.c

index 5184817e714a7911c5ffd73911dfb3544d6793a8..49c2f2fd281f7d90f5648b49d16d2607cafa4561 100644 (file)
@@ -179,8 +179,6 @@ struct kvm_memory_slot {
        unsigned long flags;
        unsigned long *rmap;
        unsigned long *dirty_bitmap;
-       unsigned long *dirty_bitmap_head;
-       unsigned long nr_dirty_pages;
        struct kvm_arch_memory_slot arch;
        unsigned long userspace_addr;
        int user_alloc;
index a612bc8c921ca3f983105846018b373c086e1376..6bd34a6ecca1b86ef7301433c74698e5aaa30466 100644 (file)
@@ -522,12 +522,11 @@ static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot)
                return;
 
        if (2 * kvm_dirty_bitmap_bytes(memslot) > PAGE_SIZE)
-               vfree(memslot->dirty_bitmap_head);
+               vfree(memslot->dirty_bitmap);
        else
-               kfree(memslot->dirty_bitmap_head);
+               kfree(memslot->dirty_bitmap);
 
        memslot->dirty_bitmap = NULL;
-       memslot->dirty_bitmap_head = NULL;
 }
 
 /*
@@ -611,8 +610,7 @@ static int kvm_vm_release(struct inode *inode, struct file *filp)
 
 /*
  * Allocation size is twice as large as the actual dirty bitmap size.
- * This makes it possible to do double buffering: see x86's
- * kvm_vm_ioctl_get_dirty_log().
+ * See x86's kvm_vm_ioctl_get_dirty_log() why this is needed.
  */
 static int kvm_create_dirty_bitmap(struct kvm_memory_slot *memslot)
 {
@@ -627,8 +625,6 @@ static int kvm_create_dirty_bitmap(struct kvm_memory_slot *memslot)
        if (!memslot->dirty_bitmap)
                return -ENOMEM;
 
-       memslot->dirty_bitmap_head = memslot->dirty_bitmap;
-       memslot->nr_dirty_pages = 0;
 #endif /* !CONFIG_S390 */
        return 0;
 }
@@ -1476,8 +1472,8 @@ void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot,
        if (memslot && memslot->dirty_bitmap) {
                unsigned long rel_gfn = gfn - memslot->base_gfn;
 
-               if (!test_and_set_bit_le(rel_gfn, memslot->dirty_bitmap))
-                       memslot->nr_dirty_pages++;
+               /* TODO: introduce set_bit_le() and use it */
+               test_and_set_bit_le(rel_gfn, memslot->dirty_bitmap);
        }
 }
 
This page took 0.035231 seconds and 5 git commands to generate.