mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-23 08:55:56 -04:00
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>
This commit is contained in:
committed by
Sean Christopherson
parent
f11aa24bdb
commit
6864c6442f
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user