|
|
Subscribe / Log in / New account

Out-of-memory victim selection with BPF

Out-of-memory victim selection with BPF

Posted Aug 18, 2023 8:36 UTC (Fri) by eduperez (guest, #11232)
In reply to: Out-of-memory victim selection with BPF by rrolls
Parent article: Out-of-memory victim selection with BPF

> To me, the intuitive and obvious approach is that programs should be written in the first place to gracefully handle situations where malloc returns NULL

I do not think that the main argument in favor of overcommit are those programs that cannot handle a "no" from malloc; returning a valid pointer, to a memory that cannot be used because there is no more memory available, is just delaying the problem. Besides, that situation should be easy to take into account by the program, in most cases.

The main argument in favor of overcommit are those programs that allocate far more memory than they really need, because (in some use cases) it is easier to allocate a large memory block, and only use some parts of it, rather than allocate multiple smaller memory blocks. With overcommit, the kernel can delay the allocation until the program really uses each block; in many cases, most of that memory will never have to be allocated at all, and can be used by other programs.

In general, OOM kicks in when a program uses a memory block, not during the malloc.


to post comments

Out-of-memory victim selection with BPF

Posted Aug 25, 2023 4:18 UTC (Fri) by ssmith32 (subscriber, #72404) [Link]

Most of the programs I've seen that try to do that have decided based on some wonky micro benchmark that They Know Best, and My Memory Allocator Algorithm Idea Is Just So Awesome, so it's time to take control of their destiny, and ignore the hard work that went into the standard allocator(s).

So, they try to play games to work around the actual memory allocator(s), blissfully ignorant of the fact they've accomplished exactly zero, and the actual memory allocator just effectively ignores their requests, and goes ahead and allocates when it decides is best.

Seems odd that we should worry about that scenario, but I can see why it happens, from both sides. E.g. Java programs working around the GC, which is on top of the userspace allocator, which is on top of the kernel allocator. They'd be better off with not Java, or understanding and configuring the many layers beneath them.


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