diff options
author | Anish Moorthy <amoorthy@google.com> | 2024-02-15 23:54:03 +0000 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-04-09 14:30:14 -0700 |
commit | 0cba6442e9e2dfabea042b899c99f5bfda5ab582 (patch) | |
tree | bc3eef423ca61cd4b116fd8eca8f0cd9bfb7af77 /tools/testing/selftests/kvm/demand_paging_test.c | |
parent | df4ec5aada9da30486d5464f34ffc80acd0373d6 (diff) | |
download | linux-stable-0cba6442e9e2dfabea042b899c99f5bfda5ab582.tar.gz linux-stable-0cba6442e9e2dfabea042b899c99f5bfda5ab582.tar.bz2 linux-stable-0cba6442e9e2dfabea042b899c99f5bfda5ab582.zip |
KVM: selftests: Use EPOLL in userfaultfd_util reader threads
With multiple reader threads POLLing a single UFFD, the demand paging test
suffers from the thundering herd problem: performance degrades as the
number of reader threads is increased. Solve this issue [1] by switching
the the polling mechanism to EPOLL + EPOLLEXCLUSIVE.
Also, change the error-handling convention of uffd_handler_thread_fn.
Instead of just printing errors and returning early from the polling
loop, check for them via TEST_ASSERT(). "return NULL" is reserved for a
successful exit from uffd_handler_thread_fn, i.e. one triggered by a
write to the exit pipe.
Performance samples generated by the command in [2] are given below.
Num Reader Threads, Paging Rate (POLL), Paging Rate (EPOLL)
1 249k 185k
2 201k 235k
4 186k 155k
16 150k 217k
32 89k 198k
[1] Single-vCPU performance does suffer somewhat.
[2] ./demand_paging_test -u MINOR -s shmem -v 4 -o -r <num readers>
Signed-off-by: Anish Moorthy <amoorthy@google.com>
Acked-by: James Houghton <jthoughton@google.com>
Link: https://lore.kernel.org/r/20240215235405.368539-13-amoorthy@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm/demand_paging_test.c')
-rw-r--r-- | tools/testing/selftests/kvm/demand_paging_test.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c index ca258968f6e1..056ff1c87345 100644 --- a/tools/testing/selftests/kvm/demand_paging_test.c +++ b/tools/testing/selftests/kvm/demand_paging_test.c @@ -13,7 +13,6 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <poll.h> #include <pthread.h> #include <linux/userfaultfd.h> #include <sys/syscall.h> |