diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-04-03 09:43:58 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-04-03 09:45:55 +0100 |
commit | e8869c4bc439de941be399d156323620a2d6ecda (patch) | |
tree | b69153bb370b5af960c0296b4c1ed0aa1a6d920f /tests | |
parent | b8afe98004ed0e082bf5d019a86f27a5909f0e4d (diff) |
gem_tiled_swapping: Limit to available memory
If there is not enough free RAM+swap for us to execute our test, we will
hit OOM, so check first.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gem_tiled_swapping.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/gem_tiled_swapping.c b/tests/gem_tiled_swapping.c index 74723645..eb1453ca 100644 --- a/tests/gem_tiled_swapping.c +++ b/tests/gem_tiled_swapping.c @@ -104,15 +104,22 @@ igt_simple_main igt_skip_on_simulation(); fd = drm_open_any(); - /* need slightly more than total ram */ - count = intel_get_total_ram_mb() * 11 / 10; + /* need slightly more than available memory */ + count = intel_get_total_ram_mb() + intel_get_total_swap_mb() / 4; bo_handles = calloc(count, sizeof(uint32_t)); igt_assert(bo_handles); idx_arr = calloc(count, sizeof(int)); igt_assert(idx_arr); - igt_require(intel_get_total_ram_mb() / 4 < intel_get_total_swap_mb()); + igt_log(IGT_LOG_INFO, + "Using %d 1MiB objects (available RAM: %ld/%ld, swap: %ld)\n", + count, + (long)intel_get_avail_ram_mb(), + (long)intel_get_total_ram_mb(), + (long)intel_get_total_swap_mb()); + + igt_require(count < intel_get_avail_ram_mb() + intel_get_total_swap_mb()); for (i = 0; i < count; i++) { bo_handles[i] = create_bo_and_fill(fd); |