static const char *page_type_name(unsigned int page_type)
diff --git a/mm/swap.c b/mm/swap.c
index 47bc1bb919cc..241880a46358 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -38,6 +38,10 @@
#include <linux/local_lock.h>
#include <linux/buffer_head.h>
+#ifdef CONFIG_KVM_GMEM_SHARED_MEM
+#include <linux/kvm_host.h>
+#endif
+
#include "internal.h"
#define CREATE_TRACE_POINTS
@@ -101,6 +105,11 @@ static void free_typed_folio(struct folio *folio)
case PGTY_hugetlb:
free_huge_folio(folio);
return;
+#endif
+#ifdef CONFIG_KVM_GMEM_SHARED_MEM
+ case PGTY_guestmem:
+ kvm_gmem_handle_folio_put(folio);
+ return;
Hm, if KVM is built as a module, will that work? Or would we need the
core-mm guest_memfd shim that would always be compiled into the core and
decouple KVM from guest_memfd ("library")?
I'd assumed that it would work, since the module would have been
loaded before this could trigger, but I guess I was wrong.
Can you point me to an example of a similar shim in the core code, for
me to add on the respin?
As part of this series, you could make the function with the WARN an
inline function, and tackle the shim separately, once that function
actually has to do something.
--
Cheers,
David / dhildenb