Re: [PATCH v5 1/7] KVM: guest_memfd: Plumb the number of pages and max order into .invalidate()

From: Xiaoyao Li

Date: Thu Jul 16 2026 - 03:12:32 EST


On 7/15/2026 7:10 AM, Sean Christopherson wrote:
Plumb the number of pages to "invalidate", i.e. reclaim, along with the max
order with which the pages can be mapped. This will allow x86 to combine
its vendor-specific implementations for conversion and reclaim, a.k.a.
preparation and invalidation, into a single hook.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/x86.c | 4 ++--
include/linux/kvm_host.h | 2 +-
virt/kvm/guest_memfd.c | 7 ++-----
3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1f5dc685f049..a2cbf6fae118 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10627,9 +10627,9 @@ int kvm_arch_gmem_prepare(struct kvm *kvm, gfn_t gfn, kvm_pfn_t pfn, int max_ord
#endif
#ifdef CONFIG_HAVE_KVM_ARCH_GMEM_INVALIDATE
-void kvm_arch_gmem_invalidate(kvm_pfn_t start, kvm_pfn_t end)
+void kvm_arch_gmem_invalidate(kvm_pfn_t pfn, kvm_pfn_t nr_pages, int max_order)

why use 'kvm_pfn_t' as the type for nr_pages instead of 'unsigned long'?

(I guess just because you kept the original type for @end)