Skip to content
Commit 931656b9 authored by Keith Busch's avatar Keith Busch Committed by Paolo Bonzini
Browse files

kvm: defer huge page recovery vhost task to later



Some libraries want to ensure they are single threaded before forking,
so making the kernel's kvm huge page recovery process a vhost task of
the user process breaks those. The minijail library used by crosvm is
one such affected application.

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 introduce some general-purpose
infrastructure for that, too.  It's similar in concept to pthread_once;
except it is actually usable, because the callback takes a parameter.

Cc: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: default avatarAlyssa Ross <hi@alyssa.is>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Message-ID: <20250123153543.2769928-1-kbusch@meta.com>
[Move call_once API to include/linux. - Paolo]
Cc: stable@vger.kernel.org
Fixes: d96c77bd ("KVM: x86: switch hugepage recovery thread to vhost_task")
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 86eb1aef
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment