summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/access_tracking_perf_test.c
diff options
context:
space:
mode:
authorColton Lewis <coltonlewis@google.com>2022-11-07 18:22:07 +0000
committerSean Christopherson <seanjc@google.com>2022-11-16 10:57:19 -0800
commit6864c6442f4dfa02c7cf48199cf3ea6bb1fe74ed (patch)
tree53f27995f75db67791895886364121aa6480740f /tools/testing/selftests/kvm/access_tracking_perf_test.c
parentf11aa24bdbc66a10378d28ee962b95426e8d2a09 (diff)
KVM: selftests: randomize which pages are written vs read
Randomize which pages are written vs read using the random number generator. Change the variable wr_fract and associated function calls to write_percent that now operates as a percentage from 0 to 100 where X means each page has an X% chance of being written. Change the -f argument to -w to reflect the new variable semantics. Keep the same default of 100% writes. Population always uses 100% writes to ensure all memory is actually populated and not just mapped to the zero page. The prevents expensive copy-on-write faults from occurring during the dirty memory iterations below, which would pollute the performance results. Each vCPU calculates its own random seed by adding its index to the seed provided. Signed-off-by: Colton Lewis <coltonlewis@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20221107182208.479157-4-coltonlewis@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm/access_tracking_perf_test.c')
-rw-r--r--tools/testing/selftests/kvm/access_tracking_perf_test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/kvm/access_tracking_perf_test.c b/tools/testing/selftests/kvm/access_tracking_perf_test.c
index a81e7a7ae18f..c0cdf07de147 100644
--- a/tools/testing/selftests/kvm/access_tracking_perf_test.c
+++ b/tools/testing/selftests/kvm/access_tracking_perf_test.c
@@ -279,7 +279,7 @@ static void run_iteration(struct kvm_vm *vm, int nr_vcpus, const char *descripti
static void access_memory(struct kvm_vm *vm, int nr_vcpus,
enum access_type access, const char *description)
{
- perf_test_set_wr_fract(vm, (access == ACCESS_READ) ? INT_MAX : 1);
+ perf_test_set_write_percent(vm, (access == ACCESS_READ) ? 0 : 100);
iteration_work = ITERATION_ACCESS_MEMORY;
run_iteration(vm, nr_vcpus, description);
}