Live data from Hacker News

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

lwn.net

101–103 of 103 posts

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

#101

While I have had my time fighting the OOM killer, I believe overcommit would have always won. To torture the metaphor a bit more, airlines have OOF mechanism - they just eject the overcommitted passengers before the plane takes off. A passenger buying a ticket is malloc(), but passengers don't always utilize the seat (use the memory). Normally this works out fine, but occasionally, there are too many passengers. Than…

I've mentioned this elsewhere in the thread, but I think it's a difference of view on what malloc represents. Operating systems do have "reserve this part of the address space" APIs and these reservations don't get charged against your commit because you're simply reserving the space, not committing to using it, and so the operating system doesn't need to back it with anything.

In this worldview, malloc is like me buying a plane ticket at the counter for a specific flight that's going to leave soon. I'd be really annoyed if I were bumped off a flight I just paid for (and would've rather been told "that flight is full, try again later" (malloc returns NULL)). This is, for example what Windows does. Under memory pressure, it'll say to applications, "hey no I'm not in a giving mood for memory right now" (and will sometimes bump the size of the pagefile if configured to do this, but only up to a point).

The thought behind this is that well... applications have to handle malloc returning NULL anyway. Whether that's calling abort and giving up is one matter, another might be to retry the allocation at a later time (maybe after Windows has bumped the pagefile size), another might be to handle an error using some preallocated buffer or whatever.

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

#102

Hey, that's me! (suggesting an OOM pardon feature) It's a funny reply. But what was not funny was the OOM killer killing my screen locker. Joke all you want, but 22 years later I still stand by that I'd rather get a kernel panic than kill the screen lock. These days you can do oom score adjusting, which is not as strong as a pardon. I may be taking too much credit, and may misremember the timeline, but I feel like so…

The modern desktops seem to have some way to jam themselves if the lock screen fails.

For example, KDE: https://preview.redd.it/plasma-lock-screen-messed-up-v0-zx7h...

GNOME: https://forums.freebsd.org/attachments/index-jpeg.8571/

I think this only works because there is top-down integration between the different parts. The compositor knows when it's supposed to be locked. Whereas the old screen lockers were just very aggressive Xorg apps that suffer from "What if two programs did this?" problems (https://devblogs.microsoft.com/oldnewthing/20110310-00/?p=11...)

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

#103
post #68

Earlier quoted context omitted.

It would be nice to have a signal as a warning to process to reduce it's memory footprint or else OOM will kill it.

You still need some way to make the kernel to send those signals to the processes of your choosing. If the kernel decides to send SIGLOWMEM to xlock instead of firefox, the xlock will get killed because it really doesn't have any memory it can give up.

SIGLOWMEM, if it existed, would have no reason to default to anything other than IGN.

It would also logically be sent to “every” process on the machine, with the subsystem probably having a heuristic to skip processes which were already signaled and have not had significant memory increases since. The goal of an early warning is to cooperatively release memory (and maybe abort memory intensive computations), the kernel already kills processes “at random”, it does not need a second way to do that.

Post reply on HN