chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
readahead: disable on low memory machines
[elogind.git]
/
src
/
readahead-common.c
diff --git
a/src/readahead-common.c
b/src/readahead-common.c
index 8533717d479ae7aa8befb3b4812aea5b537ec649..88441dbe1c913e35ae1e21245a760650347485af 100644
(file)
--- a/
src/readahead-common.c
+++ b/
src/readahead-common.c
@@
-23,6
+23,7
@@
#include <libudev.h>
#include <stdlib.h>
#include <string.h>
#include <libudev.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/sysinfo.h>
#include "log.h"
#include "readahead-common.h"
#include "log.h"
#include "readahead-common.h"
@@
-105,3
+106,13
@@
finish:
return b;
}
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 */
+}