Re: [PATCH] KVM: x86/mmu: Conditionally call kvm_zap_obsolete_pages

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

 



On Wed, Jul 31, 2024 at 6:01 PM Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>
> On 7/31/24 11:09, Hao Peng wrote:
> >> Yep.  And kvm_zap_obsolete_pages() is a relatively cheap nop if there are no
> >> pages on active_mmu_pages.  E.g. we could check kvm_memslots_have_rmaps(), but I
> >> don't see any point in doing so, as the existing code should be blazing fast
> >> relative to the total cost of the zap.
> > Here can be optimized by judging whether active_mmu_pages is empty,
> > just like kvm_zap_obsolete_pages.
> > Regardless of L0 kvm or L1 kvm, when tdp_mmu is enabled, the
> > active_mmu_pages list will not be used.
> > When ept=0 , the probability that active_mmu_pages is empty is also
> > high, not every time
> > kvm_zap_obsolete_pages is called.
>
> So if anything you could check list_empty(&kvm->arch.active_mmu_pages)
> before the loop of kvm_zap_obsolete_pages(), similar to what is done in
> kvm_mmu_zap_oldest_mmu_pages().  I doubt it can have any practical
> benefit, though.
>
> Paolo
>
I did some tests, when ept=0,  kvm_zap_obsolete_pages was called 42
times, and only 17 times
active_mmu_page list was not empty. When tdp_mmu was enabled,
active_mmu_page list
was always empty.





[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