Re: [PATCH] kvm: defer huge page recovery vhost task to later

From: Paolo Bonzini
Date: Fri Jan 24 2025 - 11:44:09 EST


> Defer the task to after the first VM_RUN call, which occurs after the
> parent process has forked all its jailed processes. This needs to happen
> only once for the kvm instance, so this patch introduces infrastructure
> to do that (Suggested-by Paolo).

Queued for 6.13; in the end I moved the new data structure to include/linux,
since it is generally usable and not limited to KVM.

> int kvm_arch_post_init_vm(struct kvm *kvm)
> {
> - return kvm_mmu_post_init_vm(kvm);
> + once_init(&kvm->arch.nx_once);
> + return 0;
> }

This could have been in kvm_arch_init_vm(), but then the last user of
kvm_arch_post_init_vm() goes away and more cleanup is in order. I'll
post the obvious patch shortly.

Thanks Keith and Alyssa.

Paolo