Hacker News new | ask | show | jobs
by feelamee 11 days ago
> if you’re a critical process like xlock, use statically allocated memory and don’t alloc again.

This doesn't save you if someone other allocates and OOM killer chooses you as victim

1 comments

What is proposed is to not have an OOM killer with a selection process, meaning that the "someone other allocates" would be the one dying.
The problem is that Linux has memory overcommit and it will OOM when a process faults a page in, not just when someone allocates memory.

So the OOM condition can hit any random process, not necessarily one that just tried to allocate. If you don't have some sort of selection, then you would still have an OOM killer, only it will be killing completely at random.

That's true, but critical processes could mlockall() after setup, so their stuff never needs paging in.
Yes, don’t have OOM roulette.
At least for processes that don't overcommit...