All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] gem_shrink:Removed gem_mappable_aperture_size and initialize alloc size to 128 MiB
@ 2020-12-08  5:03 Arjun Melkaveri
  2020-12-08  5:43 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Arjun Melkaveri @ 2020-12-08  5:03 UTC (permalink / raw)
  To: igt-dev

Initialized alloc_size to 128 MiB by replacing
gem_mappable_aperture_size. As half of
available mappable aperture may return different
size than targeted 128 MiB per process.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Arjun Melkaveri <arjun.melkaveri@intel.com>
---
 tests/i915/gem_shrink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/i915/gem_shrink.c b/tests/i915/gem_shrink.c
index dba62c8f..273234d5 100644
--- a/tests/i915/gem_shrink.c
+++ b/tests/i915/gem_shrink.c
@@ -439,7 +439,7 @@ igt_main
 		 * we expect the shrinker to start purging objects,
 		 * and possibly fail.
 		 */
-		alloc_size = gem_mappable_aperture_size() / 2;
+		alloc_size = 128 * 1024 * 1024;
 		num_processes = 1 + (mem_size / (alloc_size >> 20));
 
 		igt_info("Using %d processes and %'lluMiB per process\n",
-- 
2.25.1

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

^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [Intel-gfx] [PATCH i-g-t] i915/gem_shrink: Refactor allocation sizing based on available memory
@ 2020-12-14 20:59 Chris Wilson
  0 siblings, 0 replies; 12+ messages in thread
From: Chris Wilson @ 2020-12-14 20:59 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev, Chris Wilson

Refactor the allocation such that we utilise just enough memory pressure
to invoke the shrinker, and just enough processes to spread across the
CPUs and contend on the shrinker.

v2: Reduce over-allocation from mem_size/2 to mem_size/8, and 9
processes per cpu.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 tests/i915/gem_shrink.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/i915/gem_shrink.c b/tests/i915/gem_shrink.c
index 023db8c56..6413d25f5 100644
--- a/tests/i915/gem_shrink.c
+++ b/tests/i915/gem_shrink.c
@@ -426,6 +426,7 @@ igt_main
 	int num_processes = 0;
 
 	igt_fixture {
+		const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 		uint64_t mem_size = intel_get_total_ram_mb();
 		int fd;
 
@@ -434,16 +435,16 @@ igt_main
 
 		/*
 		 * Spawn enough processes to use all memory, but each only
-		 * uses half the available mappable aperture ~128MiB.
+		 * uses half of the available per-cpu memory.
 		 * Individually the processes would be ok, but en masse
 		 * we expect the shrinker to start purging objects,
 		 * and possibly fail.
 		 */
-		alloc_size = gem_mappable_aperture_size(fd) / 2;
-		num_processes = 1 + (mem_size / (alloc_size >> 20));
+		alloc_size = (mem_size + ncpus - 1) / ncpus / 8;
+		num_processes = ncpus + (mem_size / alloc_size);
 
-		igt_info("Using %d processes and %'lluMiB per process\n",
-			 num_processes, (long long)(alloc_size >> 20));
+		igt_info("Using %d processes and %'"PRIu64"MiB per process\n",
+			 num_processes, alloc_size);
 
 		intel_require_memory(num_processes, alloc_size,
 				     CHECK_SWAP | CHECK_RAM);
-- 
2.29.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2020-12-14 21:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08  5:03 [igt-dev] [PATCH i-g-t] gem_shrink:Removed gem_mappable_aperture_size and initialize alloc size to 128 MiB Arjun Melkaveri
2020-12-08  5:43 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-12-08  6:41 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-12-08 10:09 ` [Intel-gfx] [PATCH i-g-t] i915/gem_shrink: Refactor allocation sizing based on available memory Chris Wilson
2020-12-08 10:09   ` [igt-dev] " Chris Wilson
2020-12-08 12:13   ` [Intel-gfx] " Chris Wilson
2020-12-08 12:13     ` [igt-dev] " Chris Wilson
2020-12-08 10:43 ` [igt-dev] ✓ Fi.CI.BAT: success for gem_shrink:Removed gem_mappable_aperture_size and initialize alloc size to 128 MiB (rev2) Patchwork
2020-12-08 11:47 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-12-08 12:55 ` [igt-dev] ✓ Fi.CI.BAT: success for gem_shrink:Removed gem_mappable_aperture_size and initialize alloc size to 128 MiB (rev3) Patchwork
2020-12-08 15:22 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-12-14 20:59 [Intel-gfx] [PATCH i-g-t] i915/gem_shrink: Refactor allocation sizing based on available memory Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.