Message ID | 20180619104920.17528-1-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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;
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@chris-wilson.co.uk> --- lib/intel_os.c | 1 + 1 file changed, 1 insertion(+)