* [PATCH v2] KVM: x86/mmu: move reused pages to the top of active_mmu_pages
@ 2026-01-29 3:02 Hamza Mahfooz
0 siblings, 0 replies; only message in thread
From: Hamza Mahfooz @ 2026-01-29 3:02 UTC (permalink / raw)
To: kvm
Cc: Hamza Mahfooz, Sean Christopherson, Paolo Bonzini,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, linux-kernel
Move reused shadow pages to the head of active_mmu_pages in
kvm_mmu_find_shadow_page(). This will allow us to move towards more of
a LRU approximation eviction strategy instead of just straight FIFO.
Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>
---
v2: move logic to kvm_mmu_find_shadow_page().
---
arch/x86/kvm/mmu/mmu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 02c450686b4a..d89099ba1fca 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -2325,6 +2325,9 @@ static struct kvm_mmu_page *kvm_mmu_find_shadow_page(struct kvm *kvm,
out:
kvm_mmu_commit_zap_page(kvm, &invalid_list);
+ if (sp && !list_is_head(&sp->link, &kvm->arch.active_mmu_pages))
+ list_move(&sp->link, &kvm->arch.active_mmu_pages);
+
if (collisions > kvm->stat.max_mmu_page_hash_collisions)
kvm->stat.max_mmu_page_hash_collisions = collisions;
return sp;
--
2.52.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-01-29 3:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-29 3:02 [PATCH v2] KVM: x86/mmu: move reused pages to the top of active_mmu_pages Hamza Mahfooz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox