summaryrefslogtreecommitdiff
path: root/src/readahead-common.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-09-25 13:32:54 +0200
committerLennart Poettering <lennart@poettering.net>2010-09-25 13:32:54 +0200
commit41a598e21a9f6cfe8dad7759c3c9facd55774acf (patch)
treeb74c8538677aaf55fa7d2bdacc6ebfbf4b57a40e /src/readahead-common.c
parent4030d7a923427a50745fc5786f4905aa703f0bcb (diff)
readahead: disable on low memory machines
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 */
+}