[PATCH v12 11/84] KVM: Rename gfn_to_page_many_atomic() to kvm_prefetch_pages()
Alex Bennée
alex.bennee at linaro.org
Fri Aug 2 04:16:04 PDT 2024
Sean Christopherson <seanjc at google.com> writes:
> Rename gfn_to_page_many_atomic() to kvm_prefetch_pages() to try and
> communicate its true purpose, as the "atomic" aspect is essentially a
> side effect of the fact that x86 uses the API while holding mmu_lock.
It's never too late to start adding some kdoc annotations to a function
and renaming a kvm_host API call seems like a good time to do it.
> E.g. even if mmu_lock weren't held, KVM wouldn't want to fault-in pages,
> as the goal is to opportunistically grab surrounding pages that have
> already been accessed and/or dirtied by the host, and to do so quickly.
>
> Signed-off-by: Sean Christopherson <seanjc at google.com>
> ---
<snip>
/**
* kvm_prefetch_pages() - opportunistically grab previously accessed pages
* @slot: which @kvm_memory_slot the pages are in
* @gfn: guest frame
* @pages: array to receives page pointers
* @nr_pages: number of pages
*
* Returns the number of pages actually mapped.
*/
?
>
> -int gfn_to_page_many_atomic(struct kvm_memory_slot *slot, gfn_t gfn,
> - struct page **pages, int nr_pages)
> +int kvm_prefetch_pages(struct kvm_memory_slot *slot, gfn_t gfn,
> + struct page **pages, int nr_pages)
> {
> unsigned long addr;
> gfn_t entry = 0;
> @@ -3075,7 +3075,7 @@ int gfn_to_page_many_atomic(struct kvm_memory_slot *slot, gfn_t gfn,
>
> return get_user_pages_fast_only(addr, nr_pages, FOLL_WRITE, pages);
> }
> -EXPORT_SYMBOL_GPL(gfn_to_page_many_atomic);
> +EXPORT_SYMBOL_GPL(kvm_prefetch_pages);
>
> /*
> * Do not use this helper unless you are absolutely certain the gfn _must_ be
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
More information about the linux-riscv
mailing list