Earlier quoted context omitted.
> 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).
Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)
81–90 of 103 posts
Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)
#82Hey, 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.
Also there are other safety and security critical reasons why you'd want to exempt some processes.
Arguably (and it definitely has been argued) the real architectural misstep is the Linux kernel overcommitting by default in the first place.
Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)
#83Earlier quoted context omitted.
Yes, Wayland should fix this. Granted, then you have a locked screen that the user may or may not be able to unlock, which is awkward if better.
Wayland the protocol already fixes this -- there's nothing that exactly requires a display manager to not have a completely separate desktop for the unauthenticated state, where a trusted application (or the display manager itself) can accept credentials in order to authorize a transition to the authenticated state, and where a crash of the trusted application or lock screen does not result in access to the authentic…
No, security includes Confidentiality, Integrity, and Availability; a lockscreen DoS is a problem
Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)
#84Earlier quoted context omitted.
The point is that the OOM killer shouldn't exist and arguing about how to tweak it is addressing the wrong problem
I agree that that's the point he's making, but I don't see how that would work practically. His attitude is that malloc(1<<63) should immediately crash the system, every time? How is that better?
Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)
#85I 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!
Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)
#86I know this is not a popular / mainstream position, but I managed a very large fleet of systems this way: - no system swap - enough memory for core system services set aside in a cgroup for them to use - by default, all prod service binaries load all code pages into ram at start, and lock them in (no paging out code pages at runtime) - if needed (rare) services can mount some swap in their own cgroup, but very much d…
Have you disabled swap in the kconfig entirely? If not, is your vm.swapiness 0? How do you deal with overcommit? Did you replace malloc with a more strict implementation?
Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)
#87Earlier 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?
$ firefox-esr& PID=$!; choom -p $PID -n 42
[1] 105360
pid 105360's OOM score adjust value changed from 0 to 42
$ for p in $(ps --ppid $PID -opid --no-headers $PID); do printf "%3d" $(
See how each firefox process has a different oom_score_adj with Web Content being more likely to be killed than other processes (233), and none of them have the value that the process was started with (42). This is Firefox 140.11 ESR running on Debian 13.Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)
#88Hey, 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…
Writing -1000 to /proc//oom_score_adj will cause the OOM killer not to consider the process at all :)
From the man page proc_pid_oom_score_adj(5)
> The value of oom_score_adj is added to the badness score before it is used to determine which task to kill. Acceptable values range from -1000 (OOM_SCORE_ADJ_MIN) to +1000 (OOM_SCORE_ADJ_MAX). [...]. The lowest possible value, -1000, is equivalent to disabling OOM-killing entirely for that task, since it will always report a badness score of 0.
Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)
#89Earlier quoted context omitted.
>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.
Sure. But that's not where we are. Also there are other safety and security critical reasons why you'd want to exempt some processes. Arguably (and it definitely has been argued) the real architectural misstep is the Linux kernel overcommitting by default in the first place.
Agreed though, overcommit is the culprit here. I get why it happened (unfortunate consequences of fork and friends existing as the way to spawn tasks and wanting those to be both performant and not fail in frustrating conditions), but I don't think it was a design that aged particularly well.
I actually like somewhat the notion of how Windows handles these two things
1. For address space reservations, you can reserve address space but in order to touch it you have to commit it. Commits have to be backed by something (RAM, a file, pagefiles if they exist) and if a commit fails, they'll get NULL back from malloc. It allows code to be more correct in the face of low-memory conditions or to try again later (Firefox for example, does this[1] on Windows).
2. Process creation is done with a specific API to create processes. The only problem with this I think is that you have to specify everything at creation time, but you could augment this by creating processes in a stopped state (iirc Linux has to do this anyway to set up some stuff before it can hand over control back to userland) and having the parent send FDs to the child or whatnot. Windows... doesn't do this, it has a couple of kitchen sink APIs for creating processes and setting up stuff like the standard streams... in any case I'm getting off topic.
Don't think there's much about that design that can be changed now though
[1]: https://hacks.mozilla.org/2022/11/improving-firefox-stabilit...
Re: Re: [PATCH] OOM_pardon, a.k.a. don't kill my xlock (2004)
#90Earlier quoted context omitted.
> does fork–exec copy all the process's memory NT: Yes? Why not? (note that this refers to the Windows NT kernel's operation because it had historically a POSIX emulation layer (NT Personalities), not the modern WSL which is just Linux in a Hyper-V)
because this is what causes Windows to use ~80% more memory than unixes
There are Native APIs for implementing fork (needed for the obsolete POSIX subsystem, primarily), but even on the Native API side, processes are usually spawned through NtCreateProcess or RtlCreateUserProcess, though there is a bunch of setup with regards to the Csr APIs for the Win32 CreateProcess[1]).