News for hackers. Stuff that matters.
Re:The Linux kernel's inability to gracefully handle low mem... by yjftsjthsd-h on Monday August 05, 2019 @11:44PM (#20621943)
Probably lack of integration; if NT hits a memory issue, it can just pass notice to the tightly-coupled userland and GUI. If Linux runs out of memory, even if it internally knows what process to blame... What would it do that makes sense for a headless server, TiVo, and Android phone? Keeping in mind that the kernel folks don't even work that closely with many userspace vendors.
Re:The Linux kernel's inability to gracefully handle low mem... by wiml on Tuesday August 06, 2019 @12:24AM (#20622114)
OSX handles this with a kqueue event that can notify userland when the system moves between various memory pressure states; this is hooked into by libdispatch and other userland libraries which will discard caches and so on.

I don't see why Linux couldn't do the same; open /sys/kernel/something and epoll on it.

Re:The Linux kernel's inability to gracefully handle low mem... by antientropic on Tuesday August 06, 2019 @02:31AM (#20622722)
This already exists: applications can receive memory pressure events (such as the system reaching "medium" level, where you may want to start freeing some caches) via /sys/fs/cgroup/memory/.../memory.pressure_level. See https://www.kernel.org/doc/Documentation/cgroup-v1/memory.tx....
Re:The Linux kernel's inability to gracefully handle low mem... by packetized on Tuesday August 06, 2019 @02:51AM (#20622805)
The first two nota benes explicitly describe this document being outdated and not what most people expect when it comes to “memory controller”. I am not certain that citing this is a great example.
Re:The Linux kernel's inability to gracefully handle low mem... by Sean1708 on Tuesday August 06, 2019 @09:42AM (#20625052)
What about this? Seems to do what they want.

https://serverfault.com/a/949045

Re:The Linux kernel's inability to gracefully handle low mem... by useerup on Tuesday August 06, 2019 @02:21AM (#20622666)
Windows (server and desktop versions) will throw up a message dialog on the screen. It will also start to kill off processes just enough to resolve the low memory situation.

During this - unlike Linux - you can actually use the mouse, CLI and close programs yourself.

On top of that server applications like IIS has built-in watchdogs. If an IIS process grows to use too much memory (60% IIRC) or excessive CPU, the watchdog will recycle the process.

Re:The Linux kernel's inability to gracefully handle low mem... by StreamBright on Tuesday August 06, 2019 @03:24AM (#20622959)
I think Windows kernels do not use overcommit, so memory allocation will fail if you run out of memory.
Re:The Linux kernel's inability to gracefully handle low mem... by Asooka on Tuesday August 06, 2019 @08:01AM (#20624338)
You could use the message bus to post a message to the service that handles out of memory decisions, which in turn could either

1. Show a GUI with a choice

2. Show a message on the current terminal and ask what to do

3. Just return "kill it now" if there is no interactive session

And if there is no such service, just default to 3. The problem really is that the state cannot be captured and communicated to the user. I doubt the NT kernel itself shows a GUI window, it's probably a service that gets woken up by a kernel exception, which in turn shows the window. Basically, the Linux kernel needs more pluggable functionality for user interactions. It's absolutely fine and even recommended to not have an entire GUI in the kernel, it needs to just provide a mechanism for userspace to capture the event and decide what to do with it.

Re:The Linux kernel's inability to gracefully handle low mem... by chacham15 on Tuesday August 06, 2019 @12:01AM (#20622007)
Throw a signal like it would do if the process were out of memory completely and about to be killed? (for clarification, no snark intended, actual question)
Re:The Linux kernel's inability to gracefully handle low mem... by saagarjha on Tuesday August 06, 2019 @12:42AM (#20622194)
What signal is sent when a process is out of memory? I thought malloc would either start returning NULL or you’d fault when trying to access overcommitted memory.
Re:The Linux kernel's inability to gracefully handle low mem... by joosters on Tuesday August 06, 2019 @02:08AM (#20622599)
Yes, but ideally you want to be throwing some ‘memory pressure’ signals before absolutely running out of memory, so that programs can take simple actions like emptying caches, etc.

Catching an otherwise-fatal out-of-memory fault and recovering would be too complicated / bug-prone.

Re:The Linux kernel's inability to gracefully handle low mem... by pjmlp on Tuesday August 06, 2019 @02:35AM (#20622740)
Android sends low memory events and kills processes based on heuristics.

Then again, Android has a customized Linux kernel.

Re:The Linux kernel's inability to gracefully handle low mem... by jcfrei on Tuesday August 06, 2019 @09:22AM (#20624891)
This describes my general Linux experience well: A very stable kernel, with which I never had serious issues on a headless server. But applications in the userspace (apart from the standard GNU packages) are usually a tossup anywhere between system-crashing garbage and perfectly working pieces of software.