OLD | NEW |
1 import logging, time, random, string, math, os, tempfile | 1 import logging, time, random, string, math, os, tempfile |
2 from autotest_lib.client.common_lib import error | 2 from autotest_lib.client.common_lib import error |
3 from autotest_lib.client.bin import utils | 3 from autotest_lib.client.bin import utils |
4 import kvm_subprocess, kvm_test_utils, kvm_utils, kvm_preprocessing | 4 import kvm_subprocess, kvm_test_utils, kvm_utils, kvm_preprocessing |
5 | 5 |
6 | 6 |
7 def run_ksm_overcommit(test, params, env): | 7 def run_ksm_overcommit(test, params, env): |
8 """ | 8 """ |
9 Test how KSM (Kernel Shared Memory) act when more than physical memory is | 9 Test how KSM (Kernel Shared Memory) act when more than physical memory is |
10 used. In second part we also test how KVM handles a situation when the host | 10 used. In second part we also test how KVM handles a situation when the host |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 vm.destroy(gracefully = False) | 365 vm.destroy(gracefully = False) |
366 | 366 |
367 | 367 |
368 # Main test code | 368 # Main test code |
369 logging.info("Starting phase 0: Initialization") | 369 logging.info("Starting phase 0: Initialization") |
370 new_ksm = False | 370 new_ksm = False |
371 if (os.path.exists("/sys/kernel/mm/ksm/run")): | 371 if (os.path.exists("/sys/kernel/mm/ksm/run")): |
372 utils.run("echo 50 > /sys/kernel/mm/ksm/sleep_millisecs") | 372 utils.run("echo 50 > /sys/kernel/mm/ksm/sleep_millisecs") |
373 utils.run("echo 5000 > /sys/kernel/mm/ksm/pages_to_scan") | 373 utils.run("echo 5000 > /sys/kernel/mm/ksm/pages_to_scan") |
374 utils.run("echo 1 > /sys/kernel/mm/ksm/run") | 374 utils.run("echo 1 > /sys/kernel/mm/ksm/run") |
375 | |
376 if (os.path.exists("/sys/kernel/mm/transparent_hugepage/enabled")): | |
377 utils.run("echo 'never' > /sys/kernel/mm/transparent_hugepage/enable
d ") | |
378 if (os.path.exists("/sys/kernel/mm/redhat_transparent_hugepage/enabled")
): | |
379 utils.run("echo 'never' > /sys/kernel/mm/redhat_transparent_hugepage
/enabled ") | |
380 new_ksm = True | 375 new_ksm = True |
381 else: | 376 else: |
382 try: | 377 try: |
383 utils.run("modprobe ksm") | 378 utils.run("modprobe ksm") |
384 utils.run("ksmctl start 5000 100") | 379 utils.run("ksmctl start 5000 100") |
385 except error.CmdError, e: | 380 except error.CmdError, e: |
386 raise error.TestFail("Failed to load KSM: %s" % e) | 381 raise error.TestFail("Failed to load KSM: %s" % e) |
387 | 382 |
388 # host_reserve: mem reserve kept for the host system to run | 383 # host_reserve: mem reserve kept for the host system to run |
389 host_reserve = int(params.get("ksm_host_reserve", -1)) | 384 host_reserve = int(params.get("ksm_host_reserve", -1)) |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 if params['ksm_mode'] == "parallel": | 609 if params['ksm_mode'] == "parallel": |
615 logging.info("Starting KSM test parallel mode") | 610 logging.info("Starting KSM test parallel mode") |
616 split_parallel() | 611 split_parallel() |
617 logging.info("KSM test parallel mode: PASS") | 612 logging.info("KSM test parallel mode: PASS") |
618 elif params['ksm_mode'] == "serial": | 613 elif params['ksm_mode'] == "serial": |
619 logging.info("Starting KSM test serial mode") | 614 logging.info("Starting KSM test serial mode") |
620 initialize_guests() | 615 initialize_guests() |
621 separate_first_guest() | 616 separate_first_guest() |
622 split_guest() | 617 split_guest() |
623 logging.info("KSM test serial mode: PASS") | 618 logging.info("KSM test serial mode: PASS") |
OLD | NEW |