public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] i915/gem_tiled_swapped: Tweak mlocked size
@ 2019-08-31 13:29 Chris Wilson
  2019-08-31 14:10 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
  2019-09-01  9:58 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2019-08-31 13:29 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

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.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 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

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-01  9:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-31 13:29 [igt-dev] [PATCH i-g-t] i915/gem_tiled_swapped: Tweak mlocked size Chris Wilson
2019-08-31 14:10 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-09-01  9:58 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox