Skip to content

Commit 2ca76c1

Browse files
anlshsean-jc
authored andcommitted
KVM: selftests: Report per-vcpu demand paging rate from demand paging test
Using the overall demand paging rate to measure performance can be slightly misleading when vCPU accesses are not overlapped. Adding more vCPUs will (usually) increase the overall demand paging rate even if performance remains constant or even degrades on a per-vcpu basis. As such, it makes sense to report both the total and per-vcpu paging rates. Signed-off-by: Anish Moorthy <[email protected]> Link: https://lore.kernel.org/r/[email protected] [sean: fix formatting] Signed-off-by: Sean Christopherson <[email protected]>
1 parent fec50db commit 2ca76c1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tools/testing/selftests/kvm/demand_paging_test.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)
133133
struct uffd_desc **uffd_descs = NULL;
134134
struct timespec start;
135135
struct timespec ts_diff;
136+
double vcpu_paging_rate;
136137
struct kvm_vm *vm;
137138
int i;
138139

@@ -191,11 +192,15 @@ static void run_test(enum vm_guest_mode mode, void *arg)
191192
uffd_stop_demand_paging(uffd_descs[i]);
192193
}
193194

194-
pr_info("Total guest execution time: %ld.%.9lds\n",
195+
pr_info("Total guest execution time:\t%ld.%.9lds\n",
195196
ts_diff.tv_sec, ts_diff.tv_nsec);
196-
pr_info("Overall demand paging rate: %f pgs/sec\n",
197-
memstress_args.vcpu_args[0].pages * nr_vcpus /
198-
((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / NSEC_PER_SEC));
197+
198+
vcpu_paging_rate = memstress_args.vcpu_args[0].pages /
199+
((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / NSEC_PER_SEC);
200+
pr_info("Per-vcpu demand paging rate:\t%f pgs/sec/vcpu\n",
201+
vcpu_paging_rate);
202+
pr_info("Overall demand paging rate:\t%f pgs/sec\n",
203+
vcpu_paging_rate * nr_vcpus);
199204

200205
memstress_destroy_vm(vm);
201206

0 commit comments

Comments
 (0)