0

We are running a job where we know it squeezes the memory sometimes a bit too much. This however is resulting in killing one or two processes that we want to be the last processes killed in such a situation. How do we tell linux, please please do not kill pid XXXX and pid YYY and kill the other jobs first including that job taking up all the CPU if necessary as that job(the one we are running) is lower priority for survival than the two other processes.

Basically we are running a map/reduce job with our cassandra database and linux is deciding to kill cassandra instead of killing map/reduce tasks(which would be ideal since they have recovery built in and can black list tasks as well).

3 Answers 3

3

You can set priorities for which processes the OOM Killer will terminate.

Give a process a negative oom_adj value to make it LESS likely to be killed:

echo -15 > /proc/2592/oom_adj

Give it a positive value to make it more likely to be killed:

echo 10 > /proc/2592/oom_adj

Replace 2592 in the above commands with the actual PID's of the processes you want to protect and/or sacrifice.

2

You can:

echo -18 > /proc/$PID/oom_adj

Hope this helps

2
  • maayke, whilst we value answers which give references, we definitely prefer answers that include substantive content instead of just linking to off-site material. One reason is that substantive articles stay helpful long after their links have rotted. May I encourage you to flesh out your answer, perhaps with a quick precis of the LWN article?
    – MadHatter
    Sep 18, 2013 at 12:54
  • 1
    Sure, next time I'll remember.
    – maayke
    Sep 18, 2013 at 13:24
0

If you want the process that triggered the OOM to die, just set the appropriate sysctl:

vm.oom_kill_allocating_task=1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .