From: Chris Wilson <chris@chris-wilson.co.uk> To: intel-gfx@lists.freedesktop.org Cc: igt-dev@lists.freedesktop.org, Chris Wilson <chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH i-g-t] i915/gem_shrink: Refactor allocation sizing based on available memory Date: Tue, 8 Dec 2020 12:13:53 +0000 [thread overview] Message-ID: <20201208121353.1914932-1-chris@chris-wilson.co.uk> (raw) In-Reply-To: <20201208100951.1900238-1-chris@chris-wilson.co.uk> 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. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- 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 dba62c8fa..e8a814fe6 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() / 2; - num_processes = 1 + (mem_size / (alloc_size >> 20)); + alloc_size = (mem_size + ncpus - 1) / ncpus / 2; + 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
WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk> To: intel-gfx@lists.freedesktop.org Cc: igt-dev@lists.freedesktop.org, Chris Wilson <chris@chris-wilson.co.uk> Subject: [igt-dev] [PATCH i-g-t] i915/gem_shrink: Refactor allocation sizing based on available memory Date: Tue, 8 Dec 2020 12:13:53 +0000 [thread overview] Message-ID: <20201208121353.1914932-1-chris@chris-wilson.co.uk> (raw) In-Reply-To: <20201208100951.1900238-1-chris@chris-wilson.co.uk> 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. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- 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 dba62c8fa..e8a814fe6 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() / 2; - num_processes = 1 + (mem_size / (alloc_size >> 20)); + alloc_size = (mem_size + ncpus - 1) / ncpus / 2; + 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 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-12-08 12:14 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 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 ` Chris Wilson [this message] 2020-12-08 12:13 ` 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
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=20201208121353.1914932-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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.