Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: guest_memfd: use folio_nr_pages() instead of shift operation

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>
Link: https://lore.kernel.org/r/20251004030210.49080-1-pedrodemargomes@gmail.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

authored by

Pedro Demarchi Gomes and committed by
Sean Christopherson
765fcd7c 3f1078a4

+2 -2
+2 -2
virt/kvm/guest_memfd.c
··· 82 82 * The order will be passed when creating the guest_memfd, and 83 83 * checked when creating memslots. 84 84 */ 85 - WARN_ON(!IS_ALIGNED(slot->gmem.pgoff, 1 << folio_order(folio))); 85 + WARN_ON(!IS_ALIGNED(slot->gmem.pgoff, folio_nr_pages(folio))); 86 86 index = kvm_gmem_get_index(slot, gfn); 87 - index = ALIGN_DOWN(index, 1 << folio_order(folio)); 87 + index = ALIGN_DOWN(index, folio_nr_pages(folio)); 88 88 r = __kvm_gmem_prepare_folio(kvm, slot, index, folio); 89 89 if (!r) 90 90 kvm_gmem_mark_prepared(folio);