chiark / gitweb /
readahead: make candidate for early OOM kill
authorLennart Poettering <lennart@poettering.net>
Sat, 25 Sep 2010 12:35:34 +0000 (14:35 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 25 Sep 2010 12:35:34 +0000 (14:35 +0200)
src/readahead-collect.c
src/readahead-replay.c

index 6705615d11e7267028c48476f68e5269537c8643..47095b1f7c6c1272386bf247b6e0b534d77daa9e 100644 (file)
@@ -57,7 +57,6 @@
  * - read ahead directories
  * - sd_readahead_cancel
  * - gzip?
- * - oom adjust
  * - remount rw
  * - are filenames from anotify normalized regards /../ and // and /./?
  * - does ioprio_set work with fadvise()?
@@ -216,6 +215,8 @@ static int collect(const char *root) {
 
         assert(root);
 
+        write_one_line_file("/proc/self/oom_score_adj", "1000");
+
         if (ioprio_set(IOPRIO_WHO_PROCESS, getpid(), IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0)) < 0)
                 log_warning("Failed to set IDLE IO priority class: %m");
 
index c01f73e6a99d011f0232ac77fc43a63244237041..2fa5c182c021ba2171f7ecf256e652283f33c8b4 100644 (file)
@@ -119,6 +119,8 @@ static int replay(const char *root) {
 
         assert(root);
 
+        write_one_line_file("/proc/self/oom_score_adj", "1000");
+
         if (asprintf(&pack_fn, "%s/.readahead", root) < 0) {
                 log_error("Out of memory");
                 r = -ENOMEM;