Re: [PATCH v6 1/5] KVM: Implement dirty quota-based throttling of vcpus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 08/10/22 12:50 am, Sean Christopherson wrote:
On Fri, Oct 07, 2022, Sean Christopherson wrote:
On Thu, Sep 15, 2022, Shivam Kumar wrote:
Let's keep kvm_vcpu_check_dirty_quota(), IMO that's still the least awful name.

[*] https://urldefense.proofpoint.com/v2/url?u=https-3A__lore.kernel.org_all_Yo-2B82LjHSOdyxKzT-40google.com&d=DwIBAg&c=s883GpUCOChKOHiocYtGcg&r=4hVFP4-J13xyn-OcN0apTCh8iKZRosf5OJTQePXBMB8&m=0-XNirx6DRihxIvWzzJHJnErbZelq39geArwcitkIRgMl23nTXBs57QP543DuFnw&s=7zXRbLuhXLpsET-zMv7muSajxOFUoktaL97P3huVuhA&e=

Actually, I take that back.  The code snippet itself is also flawed.  If userspace
increases the quota (or disables it entirely) between KVM snapshotting the quota
and making the request, then there's no need for KVM to exit to userspace.

So I think this can be:

static void kvm_vcpu_is_dirty_quota_exchausted(struct kvm_vcpu *vcpu)
{
#ifdef CONFIG_HAVE_KVM_DIRTY_QUOTA
	u64 dirty_quota = READ_ONCE(vcpu->run->dirty_quota);

	return dirty_quota && (vcpu->stat.generic.pages_dirtied >= dirty_quota);
#else
	return false;
#endif
}

and the usage becomes:

		if (kvm_vcpu_is_dirty_quota_exhausted(vcpu))
			kvm_make_request(KVM_REQ_DIRTY_QUOTA_EXIT, vcpu);

More thoughts in the x86 patch.

Snapshotting is not a requirement for now anyway. We have plans to lazily update the quota, i.e. only when it needs to do more dirtying. This helps us prevent overthrottling of the VM due to skewed cases where some vcpus are mostly reading and the others are mostly wirting.


So, this looks good from every angle. The name kvm_vcpu_is_dirty_quota_exchausted, though verbose, looks good to me.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux