lib: Test against available swap
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 26 Feb 2014 11:56:16 +0000 (11:56 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 26 Feb 2014 12:06:10 +0000 (12:06 +0000)
Even if we ignore the double-accounting bug in Linux, we need to be sure
that the remaining swapspace is adequate for running our test as the
system may be under load before we even start.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
lib/intel_drm.c

index cde068b..f16e578 100644 (file)
@@ -132,7 +132,7 @@ intel_get_total_swap_mb(void)
        ret = sysinfo(&sysinf);
        assert(ret == 0);
 
-       retval = sysinf.totalswap;
+       retval = sysinf.freeswap;
        retval *= sysinf.mem_unit;
 #elif defined(HAVE_SWAPCTL) /* Solaris */
        long pagesize = sysconf(_SC_PAGESIZE);