[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <64d270e9-e54e-4b8a-855a-07932a9a884c@redhat.com>
Date: Mon, 1 Sep 2025 14:10:12 +0200
From: David Hildenbrand <david@...hat.com>
To: Shivank Garg <shivankg@....com>, pbonzini@...hat.com
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-coco@...ts.linux.dev
Subject: Re: [PATCH kvm-next 1/1] KVM: guest_memfd: Inline
kvm_gmem_get_index() and misc cleanups
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
Powered by blists - more mailing lists