units: use OOMScoreAdjust= in the unit files to set OOM score adjust
authorLennart Poettering <lennart@poettering.net>
Thu, 3 May 2012 22:15:21 +0000 (00:15 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 3 May 2012 22:15:21 +0000 (00:15 +0200)
src/readahead/readahead-collect.c
src/readahead/readahead-replay.c
units/systemd-readahead-collect.service.in
units/systemd-readahead-replay.service.in

index 70e0f66..a88e7f2 100644 (file)
@@ -253,8 +253,6 @@ static int collect(const char *root) {
                 block_get_readahead(root, &previous_block_readahead) >= 0 &&
                 block_set_readahead(root, 8*1024) >= 0;
 
-        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 0b7e6df..a6529f8 100644 (file)
@@ -132,7 +132,6 @@ static int replay(const char *root) {
 
         assert(root);
 
-        write_one_line_file("/proc/self/oom_score_adj", "1000");
         block_bump_request_nr(root);
 
         if (asprintf(&pack_fn, "%s/.readahead", root) < 0) {
index c5e1d52..887339c 100644 (file)
@@ -18,6 +18,7 @@ Type=notify
 ExecStart=@rootlibexecdir@/systemd-readahead-collect
 RemainAfterExit=yes
 StandardOutput=null
+OOMScoreAdjust=1000
 
 [Install]
 WantedBy=default.target
index 7387eba..6a10167 100644 (file)
@@ -18,6 +18,7 @@ Type=notify
 ExecStart=@rootlibexecdir@/systemd-readahead-replay
 RemainAfterExit=yes
 StandardOutput=null
+OOMScoreAdjust=1000
 
 [Install]
 WantedBy=default.target