summaryrefslogtreecommitdiff
path: root/lib/intel_os.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-08-14 14:03:52 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-08-16 09:59:10 +0100
commit2c7224e488457afb7bb76664c4b7c857baef1e08 (patch)
tree78f6d39304088f89d1121149cbfb149db53cdb7d /lib/intel_os.c
parentf5c1b2b7081f3057c325a1afba2013e7ff5b299f (diff)
lib: Keep upto half of RAM reserved for test runner
Halve our estimated available RAM for use by the tests to avoid nasty situations where the test runner may force us into swap. Rumour has it that the new runner isn't quite so bloated as piglit... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tomi Sarvela <tomi.p.sarvela@intel.com> Cc: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib/intel_os.c')
-rw-r--r--lib/intel_os.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/intel_os.c b/lib/intel_os.c
index 29a27272..4037440f 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -329,8 +329,11 @@ int __intel_check_memory(uint64_t count, uint64_t size, unsigned mode,
mode & CHECK_SWAP ? " + swap": "");
total = 0;
- if (mode & (CHECK_RAM | CHECK_SWAP))
- total += intel_get_avail_ram_mb();
+ if (mode & (CHECK_RAM | CHECK_SWAP)) {
+ total = intel_get_avail_ram_mb();
+ /* Keep some in reserve for the runner. */
+ total -= min(total / 2, 1000);
+ }
if (mode & CHECK_SWAP)
total += intel_get_total_swap_mb();
total *= 1024 * 1024;