]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: selftests: Wait for all vCPU to be created before entering guest mode
authorDavid Matlack <dmatlack@google.com>
Thu, 11 Nov 2021 00:12:56 +0000 (00:12 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 16 Nov 2021 12:43:28 +0000 (07:43 -0500)
commite707cd01828d550f06053ee306938899ab5a3cd2
treec8bf46a20b474eeeb002388915efb0f440b55505
parent24d2535cd0e33963e5caa74b90391fcbceb8d4d8
KVM: selftests: Wait for all vCPU to be created before entering guest mode

Thread creation requires taking the mmap_sem in write mode, which causes
vCPU threads running in guest mode to block while they are populating
memory. Fix this by waiting for all vCPU threads to be created and start
running before entering guest mode on any one vCPU thread.

This substantially improves the "Populate memory time" when using 1GiB
pages since it allows all vCPUs to zero pages in parallel rather than
blocking because a writer is waiting (which is waiting for another vCPU
that is busy zeroing a 1GiB page).

Before:

  $ ./dirty_log_perf_test -v256 -s anonymous_hugetlb_1gb
  ...
  Populate memory time: 52.811184013s

After:

  $ ./dirty_log_perf_test -v256 -s anonymous_hugetlb_1gb
  ...
  Populate memory time: 10.204573342s

Signed-off-by: David Matlack <dmatlack@google.com>
Message-Id: <20211111001257.1446428-4-dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/lib/perf_test_util.c