diff mbox series

[v7,16/18] KVM: x86/mmu: Enable has_fast_aging

Message ID 20240926013506.860253-17-jthoughton@google.com (mailing list archive)
State New, archived
Headers show
Series mm: multi-gen LRU: Walk secondary MMU page tables while aging | expand

Commit Message

James Houghton Sept. 26, 2024, 1:35 a.m. UTC
Because the x86 MMU locklessly implements fast_only versions of
kvm_test_age_gfn and kvm_age_gfn, we can advertise support for
has_fast_aging to allow MGLRU to quickly find better eviction
candidates.

There is one case where the MMU is not 100% accurate: for the shadow
MMU, when A/D bits are not in use, young sptes will never be aged with
the fast_only kvm_age_gfn. In this case, such pages will consistently
appear young, so they will be the least likely eviction candidates.

Signed-off-by: James Houghton <jthoughton@google.com>
---
 arch/x86/kvm/mmu/mmu.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index f47bd88b55e3..1798e3853d27 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -7708,6 +7708,8 @@  int kvm_mmu_post_init_vm(struct kvm *kvm)
 {
 	int err;
 
+	kvm->mmu_notifier.has_fast_aging = true;
+
 	if (nx_hugepage_mitigation_hard_disabled)
 		return 0;