[igt-dev] [PATCH i-g-t] i915/gem_tiled_swapping: Tweak mlocked size
Chris Wilson
chris at chris-wilson.co.uk
Tue Sep 3 19:31:51 UTC 2019
On my systems with lots of memdebug enabled, we would hit the oomkiller
90% of the time during the initial mlock prior to allocating any objects
(and about 20% of the time lockup / panic). Tweak the target allocation
sizes, and include a few more breadcrumbs tracing the allocations so
that we can reliably start the tests. We still do hit our shrinker and
even the oom notifier, so still achieving its goal of exercising low
memory and swap pressure.
To slightly compensate for the reduced mempressure (albeit we do not
remove the swapping, the raison d'etre of the test), we increase the
number of threads to force the system to reuse active fences, making it
more stressful on the fence code.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Andi Shyti <andi.shyti at intel.com>
---
tests/i915/gem_tiled_swapping.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/tests/i915/gem_tiled_swapping.c b/tests/i915/gem_tiled_swapping.c
index ddf2a748f..1b70c1e51 100644
--- a/tests/i915/gem_tiled_swapping.c
+++ b/tests/i915/gem_tiled_swapping.c
@@ -165,8 +165,9 @@ static void check_memory_layout(int fd)
igt_main
{
+ unsigned long n, count;
struct thread *threads;
- int fd, n, count, num_threads;
+ int fd, num_threads;
igt_fixture {
size_t lock_size;
@@ -179,23 +180,30 @@ igt_main
check_memory_layout(fd);
/* lock RAM, leaving only 512MB available */
- lock_size = max(0, intel_get_total_ram_mb() - AVAIL_RAM);
+ count = intel_get_total_ram_mb() - intel_get_avail_ram_mb();
+ count = max(count + 64, AVAIL_RAM);
+ lock_size = max(0, intel_get_total_ram_mb() - count);
+ igt_info("Mlocking %zdMiB of %ld/%ldMiB\n",
+ lock_size,
+ (long)intel_get_avail_ram_mb(),
+ (long)intel_get_total_ram_mb());
igt_lock_mem(lock_size);
/* need slightly more than available memory */
- count = min(intel_get_total_ram_mb(), AVAIL_RAM) * 1.25;
+ count = intel_get_avail_ram_mb() + 128;
+ igt_info("Using %lu 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());
bo_handles = calloc(count, sizeof(uint32_t));
igt_assert(bo_handles);
- num_threads = gem_available_fences(fd);
+ num_threads = gem_available_fences(fd) + 1;
+ igt_info("Using up to %d fences/threads\n", num_threads);
threads = calloc(num_threads, sizeof(struct thread));
igt_assert(threads);
- igt_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());
intel_require_memory(count, 1024*1024, CHECK_RAM | CHECK_SWAP);
for (n = 0; n < count; n++) {
--
2.23.0
More information about the igt-dev
mailing list