[Intel-gfx] [PATCH i-g-t] lib: Conservatively include residue buffers in the available ram estimate

Chris Wilson chris at chris-wilson.co.uk
Tue Jun 19 09:20:55 UTC 2018


Add any buffers reported by sysinfo to the estimate of available memory.
We do ask the kernel to purge it's caches before reporting sysinfo, but
a few remain that may be forced out by our test usage, so include them.
However, be conservative and only allow them to be swapped out.

References: https://bugs.freedesktop.org/show_bug.cgi?id=105967
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/intel_os.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/intel_os.c b/lib/intel_os.c
index 88a61f378..885ffdcec 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -105,6 +105,7 @@ intel_get_avail_ram_mb(void)
 
 	igt_assert(sysinfo(&sysinf) == 0);
 	retval = sysinf.freeram;
+	retval += min(sysinf.freeswap, sysinf.bufferram);
 	retval *= sysinf.mem_unit;
 #elif defined(_SC_PAGESIZE) && defined(_SC_AVPHYS_PAGES) /* Solaris */
 	long pagesize, npages;
-- 
2.18.0.rc2



More information about the Intel-gfx mailing list