On 27.05.25 20:02, Fuad Tabba wrote:
Track whether a guest_memfd-backed memslot supports shared memory within the memslot itself, using the flags field. The top half of memslot flags is reserved for internal use in KVM. Add a flag there to track shared memory support. This saves the caller from having to check the guest_memfd-backed file for this support, a potentially more expensive operation due to the need to get/put the file. Suggested-by: David Hildenbrand <david@xxxxxxxxxx> Signed-off-by: Fuad Tabba <tabba@xxxxxxxxxx> --- include/linux/kvm_host.h | 11 ++++++++++- virt/kvm/guest_memfd.c | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index ba83547e62b0..edb3795a64b9 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -54,7 +54,8 @@ * used in kvm, other bits are visible for userspace which are defined in * include/uapi/linux/kvm.h. */ -#define KVM_MEMSLOT_INVALID (1UL << 16) +#define KVM_MEMSLOT_INVALID (1UL << 16) +#define KVM_MEMSLOT_SUPPORTS_SHARED (1UL << 17)
Should there be a "GMEM" in there? -- Cheers, David / dhildenb