Commit 75a010e0 authored by Lennart Poettering's avatar Lennart Poettering

readahead: make candidate for early OOM kill

parent 408b85df
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
* - read ahead directories * - read ahead directories
* - sd_readahead_cancel * - sd_readahead_cancel
* - gzip? * - gzip?
* - oom adjust
* - remount rw * - remount rw
* - are filenames from anotify normalized regards /../ and // and /./? * - are filenames from anotify normalized regards /../ and // and /./?
* - does ioprio_set work with fadvise()? * - does ioprio_set work with fadvise()?
...@@ -216,6 +215,8 @@ static int collect(const char *root) { ...@@ -216,6 +215,8 @@ static int collect(const char *root) {
assert(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) 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"); log_warning("Failed to set IDLE IO priority class: %m");
......
...@@ -119,6 +119,8 @@ static int replay(const char *root) { ...@@ -119,6 +119,8 @@ static int replay(const char *root) {
assert(root); assert(root);
write_one_line_file("/proc/self/oom_score_adj", "1000");
if (asprintf(&pack_fn, "%s/.readahead", root) < 0) { if (asprintf(&pack_fn, "%s/.readahead", root) < 0) {
log_error("Out of memory"); log_error("Out of memory");
r = -ENOMEM; r = -ENOMEM;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment