From: Paolo Bonzini <pbonzini@redhat.com> To: Oliver Upton <oupton@google.com>, Jing Zhang <jingzhangos@google.com> Cc: KVM <kvm@vger.kernel.org>, KVMPPC <kvm-ppc@vger.kernel.org>, Peter Shier <pshier@google.com>, David Matlack <dmatlack@google.com>, Ben Gardon <bgardon@google.com>, Peter Feiner <pfeiner@google.com> Subject: Re: [PATCH] KVM: stats: Add VM dirty_pages stats for the number of dirty pages Date: Wed, 11 Aug 2021 12:20:23 +0200 [thread overview] Message-ID: <5183cb08-f739-e6a6-f645-3ccbe92d04d8@redhat.com> (raw) In-Reply-To: <CAOQ_QshcSQWhEUt9d7OV58V=3WrL34xfpFYS-wp6H4rzy_r_4w@mail.gmail.com> On 11/08/21 00:56, Oliver Upton wrote: > What if the statistic was 'dirtied_pages', which records the number of > pages dirtied in the lifetime of a VM? Userspace could just record the > value each time it blows away the dirty bitmaps and subtract that > value next time it reads the stat. It would circumvent the need to > walk the entire dirty bitmap to keep the statistic sane. Yeah, that'd be much better also because the "number of dirty pages" statistic is not well defined in init-all-dirty mode. Making it a vCPU stat works in fact, because mark_page_dirty_in_slot is only called with kvm_get_running_vcpu() != NULL; see kvm_dirty_ring_get() in virt/kvm/dirty_ring.c. >> >> + if (kvm->dirty_ring_size) { >> kvm_dirty_ring_push(kvm_dirty_ring_get(kvm), >> slot, rel_gfn); >> - else >> + } else { >> set_bit_le(rel_gfn, memslot->dirty_bitmap); >> + ++kvm->stat.generic.dirty_pages; >> + } > > Aren't pages being pushed out to the dirty ring just as dirty? > Yes, they are. Paolo
WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com> To: Oliver Upton <oupton@google.com>, Jing Zhang <jingzhangos@google.com> Cc: KVM <kvm@vger.kernel.org>, KVMPPC <kvm-ppc@vger.kernel.org>, Peter Shier <pshier@google.com>, David Matlack <dmatlack@google.com>, Ben Gardon <bgardon@google.com>, Peter Feiner <pfeiner@google.com> Subject: Re: [PATCH] KVM: stats: Add VM dirty_pages stats for the number of dirty pages Date: Wed, 11 Aug 2021 10:20:23 +0000 [thread overview] Message-ID: <5183cb08-f739-e6a6-f645-3ccbe92d04d8@redhat.com> (raw) In-Reply-To: <CAOQ_QshcSQWhEUt9d7OV58V=3WrL34xfpFYS-wp6H4rzy_r_4w@mail.gmail.com> On 11/08/21 00:56, Oliver Upton wrote: > What if the statistic was 'dirtied_pages', which records the number of > pages dirtied in the lifetime of a VM? Userspace could just record the > value each time it blows away the dirty bitmaps and subtract that > value next time it reads the stat. It would circumvent the need to > walk the entire dirty bitmap to keep the statistic sane. Yeah, that'd be much better also because the "number of dirty pages" statistic is not well defined in init-all-dirty mode. Making it a vCPU stat works in fact, because mark_page_dirty_in_slot is only called with kvm_get_running_vcpu() != NULL; see kvm_dirty_ring_get() in virt/kvm/dirty_ring.c. >> >> + if (kvm->dirty_ring_size) { >> kvm_dirty_ring_push(kvm_dirty_ring_get(kvm), >> slot, rel_gfn); >> - else >> + } else { >> set_bit_le(rel_gfn, memslot->dirty_bitmap); >> + ++kvm->stat.generic.dirty_pages; >> + } > > Aren't pages being pushed out to the dirty ring just as dirty? > Yes, they are. Paolo
next prev parent reply other threads:[~2021-08-11 10:20 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-10 22:32 [PATCH] KVM: stats: Add VM dirty_pages stats for the number of dirty pages Jing Zhang 2021-08-10 22:44 ` Peter Feiner 2021-08-10 22:44 ` Peter Feiner 2021-08-10 22:51 ` Jing Zhang 2021-08-10 22:51 ` Jing Zhang 2021-08-11 22:52 ` Jing Zhang 2021-08-11 22:52 ` Jing Zhang 2021-08-11 23:19 ` Peter Feiner 2021-08-11 23:19 ` Peter Feiner 2021-08-11 23:25 ` Jing Zhang 2021-08-11 23:25 ` Jing Zhang 2021-08-10 22:56 ` Oliver Upton 2021-08-10 22:56 ` Oliver Upton 2021-08-10 23:15 ` Peter Feiner 2021-08-10 23:15 ` Peter Feiner 2021-08-10 23:26 ` Oliver Upton 2021-08-10 23:26 ` Oliver Upton 2021-08-11 10:20 ` Paolo Bonzini [this message] 2021-08-11 10:20 ` Paolo Bonzini 2021-08-11 20:14 ` Jing Zhang 2021-08-11 20:14 ` Jing Zhang 2021-08-11 12:26 ` kernel test robot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=5183cb08-f739-e6a6-f645-3ccbe92d04d8@redhat.com \ --to=pbonzini@redhat.com \ --cc=bgardon@google.com \ --cc=dmatlack@google.com \ --cc=jingzhangos@google.com \ --cc=kvm-ppc@vger.kernel.org \ --cc=kvm@vger.kernel.org \ --cc=oupton@google.com \ --cc=pfeiner@google.com \ --cc=pshier@google.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.