|
|
Log in / Subscribe / Register

Too simple to fail

Too simple to fail

Posted Mar 11, 2015 15:24 UTC (Wed) by lgeorget (guest, #99972)
In reply to: Too simple to fail by dgm
Parent article: Allowing small allocations to fail

> With all that in mind, the only approach that makes sense in my mind is introducing new allocation primitives that do the right thing (fail if no memory is available) and urge everybody to migrate to they, and forbid new use of the old ones. Finally, put a hard line for removal of the faulty allocation primitives.

First rule of kernel development is not breaking legacy user code. Any new error that would come out of the kernel that did not before is considered "breaking user space". For example, as they say in the article, returning ENOMEM in some system calls that would always succeed (perhaps through triggering the OOM as a side effect) before. New allocation primitives won't help you against that.


to post comments

Too simple to fail

Posted Mar 12, 2015 0:59 UTC (Thu) by ncm (guest, #165) [Link]

Recall that this is a kernel problem. It is not user-space allocations that never fail.

A new allocation primitive for in-kernel use would be a cleaner alternative to calling the old one with the "no-retry" flag, and would be more greppable, but that's the only difference.

Too simple to fail

Posted Mar 12, 2015 15:20 UTC (Thu) by tdz (subscriber, #58733) [Link]

Any user-space program with that attitude will break sooner or later. The ERRORS sections in the man pages should not be seen as exclusive lists of possible errors. Rather the errno value coming out of the kernel or libc should be seen as a hint on what went wrong.


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