OSDN Git Service

KVM: selftests: Speed up set_memory_region_test
authorVitaly Kuznetsov <vkuznets@redhat.com>
Mon, 26 Apr 2021 13:01:21 +0000 (15:01 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Apr 2021 16:21:27 +0000 (12:21 -0400)
commit3bf0fcd754345d7ea63e1446015ba65ece6788ca
tree5da0d0548721a37b4946ac1a322924f7085fb732
parentd4787579d2133370ab47963c6527e79731df5b2a
KVM: selftests: Speed up set_memory_region_test

After commit 4fc096a99e01 ("KVM: Raise the maximum number of user memslots")
set_memory_region_test may take too long, reports are that the default
timeout value we have (120s) may not be enough even on a physical host.

Speed things up a bit by throwing away vm_userspace_mem_region_add() usage
from test_add_max_memory_regions(), we don't really need to do the majority
of the stuff it does for the sake of this test.

On my AMD EPYC 7401P, # time ./set_memory_region_test
pre-patch:
 Testing KVM_RUN with zero added memory regions
 Allowed number of memory slots: 32764
 Adding slots 0..32763, each memory region with 2048K size
 Testing MOVE of in-use region, 10 loops
 Testing DELETE of in-use region, 10 loops

 real 0m44.917s
 user 0m7.416s
 sys 0m34.601s

post-patch:
 Testing KVM_RUN with zero added memory regions
 Allowed number of memory slots: 32764
 Adding slots 0..32763, each memory region with 2048K size
 Testing MOVE of in-use region, 10 loops
 Testing DELETE of in-use region, 10 loops

 real 0m20.714s
 user 0m0.109s
 sys 0m18.359s

Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20210426130121.758229-1-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/set_memory_region_test.c