mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
KVM: Count the number of dirty pages for dirty logging
Needed for the next patch which uses this number to decide how to write protect a slot. Signed-off-by: Takuya Yoshikawa <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
This commit is contained in:
parent
9b9b149236
commit
7850ac5420
3 changed files with 7 additions and 7 deletions
|
|
@ -625,6 +625,7 @@ static int kvm_create_dirty_bitmap(struct kvm_memory_slot *memslot)
|
|||
return -ENOMEM;
|
||||
|
||||
memslot->dirty_bitmap_head = memslot->dirty_bitmap;
|
||||
memslot->nr_dirty_pages = 0;
|
||||
return 0;
|
||||
}
|
||||
#endif /* !CONFIG_S390 */
|
||||
|
|
@ -1491,7 +1492,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;
|
||||
|
||||
__set_bit_le(rel_gfn, memslot->dirty_bitmap);
|
||||
if (!__test_and_set_bit_le(rel_gfn, memslot->dirty_bitmap))
|
||||
memslot->nr_dirty_pages++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue