Skip to content

Commit

Permalink
ksm_ksmtuned: gives more time for ksm to start
Browse files Browse the repository at this point in the history
After checking the timings, the case failed because
ksmtuned needs some more time in order to start ksm
after reaching the threshold.

Signed-off-by: mcasquer <[email protected]>
  • Loading branch information
mcasquer committed Feb 20, 2024
1 parent f4b0f21 commit 1667510
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions qemu/tests/ksm_ksmtuned.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import re
import os
import time

from shutil import copyfile

Expand Down Expand Up @@ -83,23 +82,24 @@ def check_qemu_used_mem(qemu_pid, mem):
stress_timeout, 10, 10):
test.error("QEMU used memory doesn't reach %s of guest mem %sM in "
"%ss" % (mem_thres, mem // 1024, stress_timeout))
time.sleep(30)
cmd = params['cmd_check_ksm_status']
free_mem_host = utils_memory.freememtotal()
ksm_status = process.getoutput(params['cmd_check_ksm_status'])
ksm_status = utils_misc.wait_for(lambda: '1' == process.getoutput(cmd),
60)
vm.destroy()
test.log.info("The ksm threshold is %sM, QEMU used memory is %sM, "
"and the total free memory on host is %sM",
ksm_thres // 1024, mem // 1024, free_mem_host // 1024)
if threshold_reached:
if free_mem_host > ksm_thres:
test.error("Host memory is not consumed as much as expected")
if ksm_status == '0':
if not ksm_status:
test.fail("KSM should be running")
else:
if free_mem_host < ksm_thres:
test.error("Host memory is consumed too much more than "
"expected")
if ksm_status != '0':
if ksm_status:
test.fail("KSM should not be running")

total_mem_host = utils_memory.memtotal()
Expand Down

0 comments on commit 1667510

Please sign in to comment.