Commit 931656b
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: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Keith 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: d96c77b ("KVM: x86: switch hugepage recovery thread to vhost_task")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent 86eb1ae commit 931656b
File tree
4 files changed
+66
-6
lines changed- arch/x86
- include/asm
- kvm
- mmu
- include/linux
4 files changed
+66
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
1466 | 1467 | | |
1467 | 1468 | | |
1468 | 1469 | | |
| 1470 | + | |
1469 | 1471 | | |
1470 | 1472 | | |
1471 | 1473 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7447 | 7447 | | |
7448 | 7448 | | |
7449 | 7449 | | |
7450 | | - | |
| 7450 | + | |
7451 | 7451 | | |
7452 | | - | |
7453 | | - | |
| 7452 | + | |
| 7453 | + | |
7454 | 7454 | | |
7455 | 7455 | | |
7456 | 7456 | | |
7457 | 7457 | | |
7458 | 7458 | | |
7459 | 7459 | | |
| 7460 | + | |
| 7461 | + | |
| 7462 | + | |
| 7463 | + | |
| 7464 | + | |
| 7465 | + | |
| 7466 | + | |
| 7467 | + | |
| 7468 | + | |
| 7469 | + | |
7460 | 7470 | | |
7461 | 7471 | | |
7462 | | - | |
7463 | | - | |
7464 | 7472 | | |
7465 | 7473 | | |
7466 | 7474 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11471 | 11471 | | |
11472 | 11472 | | |
11473 | 11473 | | |
| 11474 | + | |
| 11475 | + | |
| 11476 | + | |
| 11477 | + | |
11474 | 11478 | | |
11475 | 11479 | | |
11476 | 11480 | | |
| |||
12748 | 12752 | | |
12749 | 12753 | | |
12750 | 12754 | | |
12751 | | - | |
| 12755 | + | |
| 12756 | + | |
12752 | 12757 | | |
12753 | 12758 | | |
12754 | 12759 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
0 commit comments