|
|
Log in / Subscribe / Register

Allowing small allocations to fail

Allowing small allocations to fail

Posted Mar 12, 2015 7:51 UTC (Thu) by dlang (guest, #313)
In reply to: Allowing small allocations to fail by malor
Parent article: Allowing small allocations to fail

except this "too small to fail" has nothing to do with userspace programs, it's all about kernel allocations.

And overcommit is not as firmly baked into Linux as you are saying. It's a simple sysctl setting to completely turn off overcommit, leading the the predictable failures (both in allocations that don't need to be failed, like when you are executing a small program from a massive one, and in application errors because they don't test the failure modes or the recovery code)


to post comments

Allowing small allocations to fail

Posted Mar 13, 2015 1:52 UTC (Fri) by malor (guest, #2973) [Link] (1 responses)

>except this "too small to fail" has nothing to do with userspace programs, it's all about kernel allocations.

Sigh. The only time a kernel memory commit can fail is if too much memory has already been granted to userspace. (or you're on a very, very tiny system to begin with.)

Allowing small allocations to fail

Posted Mar 13, 2015 2:59 UTC (Fri) by dlang (guest, #313) [Link]

> The only time a kernel memory commit can fail is if too much memory has already been granted to userspace.

Only if you include memory used for buffering writes to disk as "granted to userspace". And that memory is not something that overcommit or copy-on-write will affect in any way.

Remember that failures like this are pretty rare, if a system has even a 'little' swap (say a couple GB), it will almost certainly slow to an unusable dead crawl from the disk I/O long before the OOM killer kicks in.

Allowing small allocations to fail

Posted Mar 13, 2015 1:57 UTC (Fri) by andresfreund (subscriber, #69562) [Link]

> except this "too small to fail" has nothing to do with userspace programs, it's all about kernel allocations.

Meh. They currently can often end up as the return value of a system call if the memory allocation failure happened during the execution of a syscall. Such errors happen to be dealt with by returning the error code up the stack...


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds