For a page write fault or "page dirty", the dirty counter of the corresponding vCPU is incremented. Co-developed-by: Anurag Madnawat <anurag.madnawat@xxxxxxxxxxx> Signed-off-by: Anurag Madnawat <anurag.madnawat@xxxxxxxxxxx> Signed-off-by: Shivam Kumar <shivam.kumar1@xxxxxxxxxxx> Signed-off-by: Shaju Abraham <shaju.abraham@xxxxxxxxxxx> Signed-off-by: Manish Mishra <manish.mishra@xxxxxxxxxxx> --- virt/kvm/kvm_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 95f857c50bf2..c41b85af8682 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -3083,8 +3083,15 @@ void mark_page_dirty_in_slot(struct kvm *kvm, if (kvm->dirty_ring_size) kvm_dirty_ring_push(kvm_dirty_ring_get(kvm), slot, rel_gfn); - else + else { + struct kvm_vcpu *vcpu = kvm_get_running_vcpu(); + + if (vcpu && vcpu->kvm->dirty_quota_migration_enabled && + vcpu->vCPUdqctx) + vcpu->vCPUdqctx->dirty_counter++; + set_bit_le(rel_gfn, memslot->dirty_bitmap); + } } } EXPORT_SYMBOL_GPL(mark_page_dirty_in_slot); -- 2.22.3