Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Sharma, Nishit" <nishit.sharma@intel.com>
To: Arvind Yadav <arvind.yadav@intel.com>, <igt-dev@lists.freedesktop.org>
Cc: <pravalika.gurram@intel.com>
Subject: Re: [i-g-t] tests/intel/xe_madvise: Skip purge tests under low RAM
Date: Thu, 11 Jun 2026 14:10:42 +0530	[thread overview]
Message-ID: <81f2259a-a5a4-4c55-bd2a-ed720e09500f@intel.com> (raw)
In-Reply-To: <20260610080206.1470008-1-arvind.yadav@intel.com>


On 6/10/2026 1:32 PM, Arvind Yadav wrote:
> The purge tests create memory pressure to trigger BO eviction. If the
> system is already low on RAM, this extra pressure can push the machine
> into OOM and kill the test before it can clean up.
>
> Check available RAM before starting the pressure allocation and skip when
> there is not enough memory.
>
> Cc: Pravalika Gurram <pravalika.gurram@intel.com>
> Cc: Nishit Sharma <nishit.sharma@intel.com>
> Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>
> ---
>   tests/intel/xe_madvise.c | 14 +++++++++-----
>   1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/tests/intel/xe_madvise.c b/tests/intel/xe_madvise.c
> index cdb115d7e..f9e2c4735 100644
> --- a/tests/intel/xe_madvise.c
> +++ b/tests/intel/xe_madvise.c
> @@ -83,7 +83,7 @@ static void purgeable_setup_simple_bo(int fd, uint32_t *vm, uint32_t *bo,
>   static void trigger_memory_pressure(int fd)
>   {
>   	uint64_t mem_size, overpressure;
> -	const uint64_t chunk = 8ull << 20; /* 8 MiB */
> +	const uint64_t chunk = 8ULL << 20; /* 8 MiB */
>   	int max_objs, n = 0;
>   	uint32_t *handles;
>   	uint64_t total;
> @@ -98,14 +98,18 @@ static void trigger_memory_pressure(int fd)
>   
>   	/* dGPU: fill VRAM + 50 % to force TTM eviction */
>   	mem_size = xe_visible_vram_size(fd, 0);
> -	overpressure = mem_size / 2;
> -	if (overpressure < (64 << 20))
> -		overpressure = 64 << 20;
> +	overpressure = max_t(uint64_t, mem_size / 2, 64ULL << 20);
> +	max_objs = DIV_ROUND_UP(mem_size + overpressure, chunk);
> +
> +	/*
> +	 * Pressure BOs are faulted in and kept alive until cleanup. If the
> +	 * system is already low on RAM, this can cause OOM.
> +	 */
> +	igt_require_memory(max_objs, chunk, CHECK_RAM);
>   
>   	/* Separate VM so pressure BOs don't interfere with the test */
>   	vm = xe_vm_create(fd, 0, 0);
>   
> -	max_objs = (mem_size + overpressure) / chunk + 1;
>   	handles = malloc(max_objs * sizeof(*handles));
>   	igt_assert(handles);
>   

LGTM:

Reviewed-by: Nishit Sharma <nishit.sharma@intel.com>


  parent reply	other threads:[~2026-06-11  8:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10  8:02 [i-g-t] tests/intel/xe_madvise: Skip purge tests under low RAM Arvind Yadav
2026-06-10 21:39 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-06-10 22:24 ` ✓ i915.CI.BAT: " Patchwork
2026-06-11  4:04 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-06-11  8:40 ` Sharma, Nishit [this message]
2026-06-11 15:54 ` [i-g-t] " Kamil Konieczny
2026-06-12  4:26   ` Yadav, Arvind
2026-06-11 19:25 ` ✗ i915.CI.Full: failure for " 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=81f2259a-a5a4-4c55-bd2a-ed720e09500f@intel.com \
    --to=nishit.sharma@intel.com \
    --cc=arvind.yadav@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=pravalika.gurram@intel.com \
    /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