summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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;