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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
---
 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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux