Live data from Hacker News

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

lwn.net

71–80 of 103 posts

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

#71
post #43
post #28

Earlier quoted context omitted.

I'm aware of it, but it's awkward to use in practice. You have to track down all the FF processes, each time you run it, and adjust all their scores.

Maybe firefox could self-adjust, as a policy?

Yes this would be nice. Or maybe the OOM system would have two other files, /sys/oom/kill_first and /sys/oom/kill_never which would solve the problem more directly for the majority of cases.

I should really send a patch rather than complaining ...

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

#72
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 someone took my crappy kernel patch and went "fine, I'll do it the right way", merged that oom score adjusting maybe a year or so later.

Here's an LWN article about it, too: https://lwn.net/Articles/104179/

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

#73
post #68
post #13

It's 2026 and I still can't configure the OOM killer to kill firefox before anything else.

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.

It’s possible via cgroups, kinda.

cgroups v1 has a pretty nice API but it requires root. V2 does not require root but it’s a lot coarser and not as simple or reliable: https://unix.stackexchange.com/questions/753929/receive-a-me...

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

#74
post #68
post #13

It's 2026 and I still can't configure the OOM killer to kill firefox before anything else.

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.

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

#75

Earlier quoted context omitted.

because this is what causes Windows to use ~80% more memory than unixes

Well, in that case it's a good thing I guess. Windows is orders of magnitude better when it comes to memory management on the desktop compared to Linux. Like why would I even want a single process killed by OOM killer? On Windows things just work, or get slow. On Linux it works and then mayhem ensues. Last year I was writing a reply on a forum in Firefox on Linux when the OOM killer decided to nuke Firefox. Poof gone…

> Windows is orders of magnitude better when it comes to memory management on the desktop compared to Linux.

The bar is pretty low, but the windows scheduler is aware what the currently focussed app is so it can prioritise not killing it.

On Linux? Not so much.

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

#76

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…

>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.

An argument can be made that the kernel should not cover for architectural missteps of the X server and that X server should be the one to crash when it's security-critical component was killed for whatever reason.

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

#77
post #49

I confess, this is very funny and the underlying situation is a bit absurd, but it's unclear what point Brouwer is making by pointing out the absurdity. There surely is something absurd about having to register specific processes as exempt from the OOM killer. But given that the OOM killer exists, and could kill xlock...how should that be fixed?

I think part of it is that the design of screen lockers on X11 is just broken. If the locker crashes (or is killed), then the screen unlocks. Security-wise, it fails open. On Windows and macOS (and Wayland, using the ext-screen-lock protocol, coupled with sane compositor policy), that can't happen. The right way for this to work is for the X server to have an extension that lets a screen locker say "hey, I'm locking…

Admittedly, that's right, and makes sense for that use case. But as others have pointed out, killing the user's web browser while they're using it is equally painful.

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

#79
post #68
post #13

It's 2026 and I still can't configure the OOM killer to kill firefox before anything else.

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.

https://systemd.io/MEMORY_PRESSURE/

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

#80

Earlier quoted context omitted.

Well, in that case it's a good thing I guess. Windows is orders of magnitude better when it comes to memory management on the desktop compared to Linux. Like why would I even want a single process killed by OOM killer? On Windows things just work, or get slow. On Linux it works and then mayhem ensues. Last year I was writing a reply on a forum in Firefox on Linux when the OOM killer decided to nuke Firefox. Poof gone…

> Windows is orders of magnitude better when it comes to memory management on the desktop compared to Linux. The bar is pretty low, but the windows scheduler is aware what the currently focussed app is so it can prioritise not killing it. On Linux? Not so much.

Actually, it depends on the Windows scheduler settings. On Windows Server, the default is to kill the foreground process (on the assumption that it is just a management app rather than a critical server component).
Post reply on HN