Live data from Hacker News

Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)

lwn.net

11–20 of 103 posts

Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)

#11
post #2

I’d say, let the one who tried to allocate memory crash, and if you’re a critical process like xlock, use statically allocated memory and don’t alloc again.

Statically allocated memory can still OOM on access, due to overcommit and lazy page table population. What you really want is mlockall(2) (probably with MCL_CURRENT|MCL_ONFAULT followed by madvise with MADV_POPULATE_*)

Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)

#12
post #2

I’d say, let the one who tried to allocate memory crash, and if you’re a critical process like xlock, use statically allocated memory and don’t alloc again.

This is only a viable answer when overcommit is disabled. The problem comes when overcommit is enabled and you find yourself in a position where many programs think they already have memory and yet there is none to give them. If you simply kill the first piece of code that encounters the end of available memory you might take down anything including the kernel itself. Nothing like statically allocating memory can wor…

[deleted]

Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)

#14
post #6
post #5

Earlier quoted context omitted.

> 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

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.

Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)

#18
post #16
post #2

I’d say, let the one who tried to allocate memory crash, and if you’re a critical process like xlock, use statically allocated memory and don’t alloc again.

The fact that xlock crashing unlocks an X11 session is, IMO, pathetic.

[flagged]

Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)

#19
I still remember following Andries’s “Linux kernel hacker’s hut” course he taught at the Eindhoven University of Technology (TU/e) back in 2010. Every week we’d get an assignment where we had to write exploits for commonly occurring security vulnerabilities (e.g., buffer overflows, bad printf format). It was one of the most enjoyable courses I ever followed. Thanks for that, Andries!
Post reply on HN