1

I would like to prioritize stability over performance. So I would like my processes to hang instead of my whole OS when I hit hardware limits

I would like to always let some resources for the kernel it if needs it. And maybe the desktop session, but I'm not sure because it can be too heavy, eat too much resources

But often, what takes 95% of my resources is the programs that runs into the session. I would like them to take less resources, even if it means for them to freeze, as long as WM and kernel has resources to breathe, to let my mouse move. Ideally to perform commands from a GUI terminal, or at least a TTY

I don't want OOM killer to make dissapear all my work or to be obliged to reboot my whole system

Limit resources usage will let OOM sleep because there will be some resources left, and the kernel will not hang so I won't be obliged to reboot, so no work lost at all

I know that programs can run on the resources we gave them. I was using same program with tiny computers and big computers and they always run. So there should be a way for making them use less in a nice manner

I don't want to deny overcommit, many software rely on it to even run. I would prefer limits, they will handle it better

1
  • I assume you are using Linux? Also, have you tried disabling memory overcommit?
    – forest
    Dec 12, 2022 at 22:52

1 Answer 1

0

You can disable memory overcommit by setting vm.overcommit_memory to 2:

2 - Don't overcommit. The total address space commit for the system is not permitted to exceed swap + a configurable amount (default is 50%) of physical RAM. Depending on the amount you use, in most situations this means a process will not be killed while accessing pages but will receive errors on memory allocation as appropriate.

If you do this, the kernel will only allocate memory to applications that it can actually guarantee for processes. When overcommit is enabled, on the other hand, the kernel will allocate more memory than it has, under the assumption that most applications request more memory than they ever actually touch. When overcommit is disabled, applications may be unable to request more memory. The requesting application may crash (depending on how it handles malloc() returning NULL).

See https://www.kernel.org/doc/Documentation/vm/overcommit-accounting

1
  • I've already seen this solution. But I read that it's to avoid because software are, in some views, badly made, they don't manage well malloc denying and they work by largely overcommiting, otherwise crashing. Thats why I would pefers limits, because on tiny hardware they seems to work well, so with limits it will do the same
    – aaa
    Dec 13, 2022 at 7:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .