Re: [PATCH kvm-next 1/1] KVM: guest_memfd: Inline kvm_gmem_get_index() and misc cleanups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01.09.25 07:15, Shivank Garg wrote:
Move kvm_gmem_get_index() to the top of the file and mark it inline.

The marking of "inline" is not really required. A modern compiler can figure itself out that there is benefit in just inlining it.

I would rephrase the subject as

"KVM: guest_memfd: use kvm_gmem_get_index() in more places and smaller
 cleanups"


Also clean up __kvm_gmem_get_pfn() by deferring gmem variable
declaration until after the file pointer check, avoiding unnecessary
initialization.

The compiler will figure that out. It's rather "No need to initialize 'gmem' in __kvm_gmem_get_pfn() because we are already initializing it a second time, before using it."

However, I would rather drop the "gmem = file->private_data;" instead, because the compiler will optimize this either way.

--
Cheers

David / dhildenb





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux