Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yadav, Arvind" <arvind.yadav@intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	<igt-dev@lists.freedesktop.org>, <nishit.sharma@intel.com>,
	<pravalika.gurram@intel.com>
Subject: Re: [i-g-t] tests/intel/xe_madvise: Skip purge tests under low RAM
Date: Fri, 12 Jun 2026 09:56:33 +0530	[thread overview]
Message-ID: <db8f3421-241e-42ac-85e5-57fcefb7e858@intel.com> (raw)
In-Reply-To: <20260611155446.kiso6cph53arklnl@kamilkon-DESK.igk.intel.com>


On 11-06-2026 21:24, Kamil Konieczny wrote:
> Hi Arvind,
> On 2026-06-10 at 13:32:06 +0530, 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);
> imho this is no-op, you will alwayes get 'mem_size / 2' for dGPU.
> Maybe just add igt_require(mem_size)?


Agree, will drop max_t() and keep the original two-line overpressure 
calculation.

>
>> +	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.
>> +	 */
> Can we just lower how much VRAM will be requested? For example
> fill VRAM + 10%


I would prefer not to reduce the pressure in this patch. The test 
currently uses VRAM + 50% to reliably force TTM eviction and purge 
DONTNEED BOs. Reducing it to VRAM + 10% changes the test behavior and 
may make purge harder to trigger.

>
>> +	igt_require_memory(max_objs, chunk, CHECK_RAM);
> So you need to get size of system memory and adjust overpressure,
> but that can be postponed after this change will be merged.


Yes, agreed. For this fix, I will keep it simple and just add the RAM 
availability check before creating the pressure BOs. We can make the 
pressure adaptive in a follow-up change.


Thanks,
~Arvind

>
> Regards,
> Kamil
>
>>   
>>   	/* 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);
>>   
>> -- 
>> 2.43.0
>>

  reply	other threads:[~2026-06-12  4:27 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 ` [i-g-t] " Sharma, Nishit
2026-06-11 15:54 ` Kamil Konieczny
2026-06-12  4:26   ` Yadav, Arvind [this message]
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=db8f3421-241e-42ac-85e5-57fcefb7e858@intel.com \
    --to=arvind.yadav@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=nishit.sharma@intel.com \
    --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