KVM: x86/mmu: move reused pages to the top of active_mmu_pages
PATCH v2 1/1 KVM: x86/mmu: move reused pages to the top of active_mmu_pages
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 <[email protected]>
---
v2: move logic to kvm_mmu_find_shadow_page().
--- arch/x86/kvm/mmu/mmu.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kvm/mmu/mmu.c +3 -0
@@ -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;
Signature · 1 line
2.52.0