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