@@ -500,6 +500,11 @@ static ssize_t kvm_kmem_gmem_write(struct file *file, const char __user *buf,
return ret && start == (*offset >> PAGE_SHIFT) ?
ret : *offset - (start << PAGE_SHIFT);
}
+
+bool kvm_gmem_vma_is_gmem(struct vm_area_struct *vma)
+{
+ return vma->vm_ops == &kvm_gmem_vm_ops;
+}
#endif /* CONFIG_KVM_GMEM_SHARED_MEM */
static struct file_operations kvm_gmem_fops = {
@@ -73,6 +73,7 @@ int kvm_gmem_create(struct kvm *kvm, struct kvm_create_guest_memfd *args);
int kvm_gmem_bind(struct kvm *kvm, struct kvm_memory_slot *slot,
unsigned int fd, loff_t offset);
void kvm_gmem_unbind(struct kvm_memory_slot *slot);
+bool kvm_gmem_vma_is_gmem(struct vm_area_struct *vma);
#else
static inline void kvm_gmem_init(struct module *module)
{
It will be used to distinguish the vma type in userfaultfd code. This likely needs to be done in the guestmem library. Signed-off-by: Nikita Kalyazin <kalyazin@amazon.com> --- virt/kvm/guest_memfd.c | 5 +++++ virt/kvm/kvm_mm.h | 1 + 2 files changed, 6 insertions(+)