Skip to content

Commit

Permalink
Merge pull request autotest#5658 from QianJianhua1/memnotenough
Browse files Browse the repository at this point in the history
numa: fix no enough memory
  • Loading branch information
dzhengfy authored Jun 19, 2024
2 parents 0f7249d + b7da870 commit bb5ba5b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
qemu_monitor_option = '--hmp'
qemu_monitor_cmd = 'info memdev'
cpu_mode = 'host-model'
target_hugepages = 1024
aarch64:
cpu_mode = 'host-passthrough'
target_hugepages = 32
hugepage_size = 2048
numa_cell_0 = {'id': '0', 'memory': '1048576', 'cpus': '0-1'}
numa_cell_1 = {'id': '1', 'memory': '1048576', 'cpus': '2-3'}
numa_cells = [${numa_cell_0}, ${numa_cell_1}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ def setup_default(test_obj):
"""
test_obj.setup()
hpc = test_setup.HugePageConfig(test_obj.params)

numa_cells = eval(test_obj.params.get('numa_cells', '[]'))
if numa_cells:
#set target_hugepages according to the setting of 'numa_cells'.
total_mem = 0
for i in range(len(numa_cells)):
total_mem += int(numa_cells[i]['memory'])
test_obj.params["target_hugepages"] = int(total_mem/hpc.get_hugepage_size())
hpc = test_setup.HugePageConfig(test_obj.params)

hpc.setup()
test_obj.params['hp_config_obj'] = hpc
test_obj.test.log.debug("Step: setup is done")
Expand Down

0 comments on commit bb5ba5b

Please sign in to comment.