I do not know if this works on all distributions of Linux.
Make a process less likely to get killed off. nnn = pid
echo -15 > /proc/nnn/oom_adj
We can make the OOM killer more likely to kill the nnn process by doing the following.
echo 10 > /proc/nnn/oom_adj
However.
This does not sound like a great solution to me. I would do something about limiting resources on processes long before considering this kind of thing. ulimit is there for exactly this reason. This does not invalidate your current approach if you've already done that. But it does answer the question, I guess. It would require you to:
monitor things and take action to enable kill off
take this kill approach a priori if you 'know' you can live without something. Which raises the question - why is that process running if you can live without it?