Skip to content

Commit

Permalink
Updating the test to calculate necessary target_hugepages based on ac…
Browse files Browse the repository at this point in the history
…tual hp size and required VM memory. Therefore some configuration settings are no more necessary.
  • Loading branch information
hholoubk committed Oct 10, 2024
1 parent f07809d commit 4c1852e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,5 @@
start_vm = "no"
umask_value = '027'
mem_backing_attrs = {'hugepages': {}}
default_hp_size = 2048
target_hugepages = 1024
aarch64:
default_hp_size = 524288
target_hugepages = 4
s390-virtio:
kvm_module_parameters = "hpage=1"
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,11 @@ def run(test, params, env):
shutil.rmtree(hp_path)
utils_libvirtd.Libvirtd().restart()

# verify test runs on machine with expected size of hugepages
# and recalculate the target_hugepage if necessary
default_hp_size = int(params.get("default_hp_size", 2048))
target_hugepages = int(params.get("target_hugepages", 1024))
# calculate the target_hugepage from VM memory and actual HP size
actual_hp_size = avocado_mem.get_huge_page_size()
if actual_hp_size != default_hp_size:
# actual hp size is different that is expected for defined number of hugepages
# as the size is not the main focus of the test, we have to recalculate and replace
new_target_hugepages = int((default_hp_size * target_hugepages) / actual_hp_size)
test.log.warn(f"Default HP size is different than expected. Parameter 'target_hugepagees' was updated: {new_target_hugepages}")
params["target_hugepages"] = new_target_hugepages
target_hugepages = int(vmxml.memory / actual_hp_size)
params["target_hugepages"] = target_hugepages
test.log.debug(f"Requred VM memory {vmxml.memory}, calculated tareget_hugepages: {target_hugepages}")

hp_cfg = test_setup.HugePageConfig(params)
hp_cfg.set_hugepages()
Expand Down

0 comments on commit 4c1852e

Please sign in to comment.