summaryrefslogtreecommitdiff
path: root/src/readahead-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/readahead-common.c')
-rw-r--r--src/readahead-common.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/readahead-common.c b/src/readahead-common.c
index 8533717d47..88441dbe1c 100644
--- a/src/readahead-common.c
+++ b/src/readahead-common.c
@@ -23,6 +23,7 @@
#include <libudev.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/sysinfo.h>
#include "log.h"
#include "readahead-common.h"
@@ -105,3 +106,13 @@ finish:
return b;
}
+
+bool enough_ram(void) {
+ struct sysinfo si;
+
+ assert_se(sysinfo(&si) >= 0);
+
+ return si.totalram > 127 * 1024*1024; /* Enable readahead only
+ * with at least 128MB
+ * memory */
+}