Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] i915/gem_tiled_swapping: Tweak mlocked size
Date: Tue,  3 Sep 2019 20:31:51 +0100	[thread overview]
Message-ID: <20190903193151.3132-1-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20190902041548.14919-3-chris@chris-wilson.co.uk>

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@chris-wilson.co.uk>
Cc: Andi Shyti <andi.shyti@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

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

  parent reply	other threads:[~2019-09-03 19:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-02  4:15 [igt-dev] [PATCH i-g-t 1/6] lib: Fix gem_measure_ring_inflight Chris Wilson
2019-09-02  4:15 ` [igt-dev] [PATCH i-g-t 2/6] i915/gem_ctx_shared: Prebind both context images Chris Wilson
2019-09-03 15:25   ` Andi Shyti
2019-09-02  4:15 ` [igt-dev] [PATCH i-g-t 3/6] i915/gem_tiled_swapped: Tweak mlocked size Chris Wilson
2019-09-03 15:32   ` Andi Shyti
2019-09-03 19:31   ` Chris Wilson [this message]
2019-09-04  6:47     ` [igt-dev] [PATCH i-g-t] i915/gem_tiled_swapping: " Andi Shyti
2019-09-02  4:15 ` [igt-dev] [PATCH i-g-t 4/6] Add i915/gem_ctx_persistence Chris Wilson
2019-09-03 17:50   ` Andi Shyti
2019-09-02  4:15 ` [Intel-gfx] [PATCH i-g-t 5/6] i915/gem_mocs_settings: Fudge gen11:vcs2 mocs register base Chris Wilson
2019-09-02  4:15 ` [igt-dev] [PATCH i-g-t 6/6] i915/gem_exec_balancer: Beware the migratory fence Chris Wilson
2019-09-02  4:49 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/6] lib: Fix gem_measure_ring_inflight Patchwork
2019-09-02  6:27 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-09-03 12:53 ` [igt-dev] [PATCH i-g-t 1/6] " Andi Shyti
2019-09-03 20:06 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/6] lib: Fix gem_measure_ring_inflight (rev2) Patchwork
2019-09-03 23:10 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190903193151.3132-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox