summaryrefslogtreecommitdiff
path: root/lib/intel_os.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-06-19 10:17:40 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-06-19 15:39:10 +0100
commit9ab9268fa7eeda0a7ea6eb2ab02bb6c5b9c91ba0 (patch)
tree2caf7ba470834310d0cc703113929d52d121ca8b /lib/intel_os.c
parent778497e7965dc8662c770a89ebbd741778feb71e (diff)
lib: Conservatively include residual buffers in the available ram estimate
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> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Diffstat (limited to 'lib/intel_os.c')
-rw-r--r--lib/intel_os.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/intel_os.c b/lib/intel_os.c
index 88a61f37..885ffdce 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;