Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Shivank Garg <shivankg@amd.com>, pbonzini@redhat.com
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-coco@lists.linux.dev
Subject: Re: [PATCH kvm-next 1/1] KVM: guest_memfd: Inline kvm_gmem_get_index() and misc cleanups
Date: Mon, 1 Sep 2025 14:10:12 +0200	[thread overview]
Message-ID: <64d270e9-e54e-4b8a-855a-07932a9a884c@redhat.com> (raw)
In-Reply-To: <20250901051532.207874-3-shivankg@amd.com>

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


      reply	other threads:[~2025-09-01 12:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01  5:15 [PATCH kvm-next 1/1] KVM: guest_memfd: Inline kvm_gmem_get_index() and misc cleanups Shivank Garg
2025-09-01 12:10 ` David Hildenbrand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64d270e9-e54e-4b8a-855a-07932a9a884c@redhat.com \
    --to=david@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=shivankg@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox