From: Hamza Mahfooz <someguy@effective-light.com>
To: kvm@vger.kernel.org
Cc: Hamza Mahfooz <someguy@effective-light.com>,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2] KVM: x86/mmu: move reused pages to the top of active_mmu_pages
Date: Wed, 28 Jan 2026 22:02:30 -0500 [thread overview]
Message-ID: <20260129030231.567759-1-someguy@effective-light.com> (raw)
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
reply other threads:[~2026-01-29 3:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260129030231.567759-1-someguy@effective-light.com \
--to=someguy@effective-light.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox