From: David Hildenbrand <david@redhat.com>
To: Pedro Demarchi Gomes <pedrodemargomes@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: use folio_nr_pages() instead of shift operation
Date: Wed, 22 Oct 2025 21:40:46 +0200 [thread overview]
Message-ID: <73fc00c5-5626-43b0-be46-6b89a9004375@redhat.com> (raw)
In-Reply-To: <20251004030210.49080-1-pedrodemargomes@gmail.com>
On 04.10.25 05:02, Pedro Demarchi Gomes wrote:
> folio_nr_pages() is a faster helper function to get the number of pages when
> NR_PAGES_IN_LARGE_FOLIO is enabled.
>
> Signed-off-by: Pedro Demarchi Gomes <pedrodemargomes@gmail.com>
> ---
> virt/kvm/guest_memfd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
> index 7d85cc33c0bb..5fc5475cf826 100644
> --- a/virt/kvm/guest_memfd.c
> +++ b/virt/kvm/guest_memfd.c
> @@ -77,9 +77,9 @@ static int kvm_gmem_prepare_folio(struct kvm *kvm, struct kvm_memory_slot *slot,
> * The order will be passed when creating the guest_memfd, and
> * checked when creating memslots.
> */
> - WARN_ON(!IS_ALIGNED(slot->gmem.pgoff, 1 << folio_order(folio)));
> + WARN_ON(!IS_ALIGNED(slot->gmem.pgoff, folio_nr_pages(folio)));
> index = gfn - slot->base_gfn + slot->gmem.pgoff;
> - index = ALIGN_DOWN(index, 1 << folio_order(folio));
> + index = ALIGN_DOWN(index, folio_nr_pages(folio));
> r = __kvm_gmem_prepare_folio(kvm, slot, index, folio);
> if (!r)
> kvm_gmem_mark_prepared(folio);
FWIW
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Cheers
David / dhildenb
prev parent reply other threads:[~2025-10-22 19:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-04 3:02 Pedro Demarchi Gomes
2025-10-15 18:02 ` Sean Christopherson
2025-10-20 15:51 ` Sean Christopherson
2025-10-22 19:40 ` 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=73fc00c5-5626-43b0-be46-6b89a9004375@redhat.com \
--to=david@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=pedrodemargomes@gmail.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
all inboxes | Powered by JetHome®