Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 3/4] i915/gem_shrink: Refactor allocation sizing based on available memory
Date: Mon, 14 Dec 2020 15:57:59 +0000	[thread overview]
Message-ID: <db3f4d96-1143-168b-dfa0-f49fd856832d@linux.intel.com> (raw)
In-Reply-To: <20201214105123.542518-3-chris@chris-wilson.co.uk>


On 14/12/2020 10:51, Chris Wilson wrote:
> 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 023db8c56..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(fd) / 2;
> -		num_processes = 1 + (mem_size / (alloc_size >> 20));
> +		alloc_size = (mem_size + ncpus - 1) / ncpus / 2;

Div round up with thousands divided by small integers okay, safe on very 
old smp boxes. :)

> +		num_processes = ncpus + (mem_size / alloc_size);

Hm, now what does this add up to..

ncpus + mem_size / (mem_size / ncpus / 2) = ... ?

Regards,

Tvrtko

>   
> -		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);
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2020-12-14 15:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 10:51 [igt-dev] [PATCH i-g-t 1/4] i915/perf_pmu: Verify RC6 measurements before/after suspend Chris Wilson
2020-12-14 10:51 ` [igt-dev] [PATCH i-g-t 2/4] i915/gem_exec_balancer: Measure timeslicing fairness Chris Wilson
2020-12-14 15:51   ` Tvrtko Ursulin
2020-12-14 16:02     ` [Intel-gfx] " Chris Wilson
2020-12-14 10:51 ` [igt-dev] [PATCH i-g-t 3/4] i915/gem_shrink: Refactor allocation sizing based on available memory Chris Wilson
2020-12-14 15:57   ` Tvrtko Ursulin [this message]
2020-12-14 16:21     ` Chris Wilson
2020-12-14 16:24       ` [Intel-gfx] " Chris Wilson
2020-12-14 10:51 ` [igt-dev] [PATCH i-g-t 4/4] i915/gem_exec_schedule: Try to spot unfairness Chris Wilson
2020-12-14 11:30 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] i915/perf_pmu: Verify RC6 measurements before/after suspend Patchwork
2020-12-14 13:55 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-12-14 15:42 ` [igt-dev] [PATCH i-g-t 1/4] " Tvrtko Ursulin
2020-12-14 15:49   ` Chris Wilson
2020-12-14 16:08     ` Tvrtko Ursulin
2020-12-14 16:17       ` Chris Wilson
2020-12-14 16:18         ` 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=db3f4d96-1143-168b-dfa0-f49fd856832d@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=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