0

According to this document: https://www.kernel.org/doc/Documentation/vm/overcommit-accounting , if I set "vm.overcommit_memory" to "2", then "The total address space commit for the system is not permitted to exceed swap + a configurable amount (default is 50%) of physical RAM." Also, "The overcommit amount can be set via 'vm.overcommit_ratio' (percentage) or 'vm.overcommit_kbytes' (absolute value)."

My question is, are the "vm.overcommit_ratio" and "vm.overcommit_kbytes" limiting the total sum of memory commit by all processes, or just limiting each process?

I think it should be the latter, because it makes no sense to limit the system to use only half of physical memory in total, but the description in the document suggests it is limiting globally.

2

It is global. The purpose of the setting is to make sure that you can not use up all of your memory and cause the OOM killer to start killing processes.

2

I think it should be the latter,

It's the former.

because it makes no sense to limit the system to use only half of physical memory in total, but the description in the document suggests it is limiting globally.

Agreed. But this is not a limit on how much physical memory is used. As it says, it limits committed address space, not physical memory usage. Of course the system will use pretty much all of its RAM.

  • So if I disable overcommit and disable swap, this value should be 100 right? – Sam Mar 14 '17 at 6:29
  • @Sam I'm not sure what value you're talking about. But if you mean the amount of permitted committed address space, with no swap and a value of 100, system behavior could become very pathological as RAM gets cluttered with dirty pages that will almost never be used and the system has no place to eject them. The set of clean pages could get very badly squeezed resulting on atrocious performance and constant discarding and re-loading of clean pages. – David Schwartz Mar 14 '17 at 17:02
  • Yes I mean "vm.overcommit_memory=2" and "vm.overcommit_ratio=100". So you mean it shouldn't be 100? But lower than that would mean I cannot even make use of all my RAM if I disable overcommit and disable swap, right? – Sam Mar 14 '17 at 17:33
  • @Sam You can make use of all your RAM. Again, that is not a setting of what percentage of your RAM will be used. (But yes, no matter how you set anything, it is impossible to make good use of all your RAM without swap. Swap exists to allow us to make efficient use of RAM. See my comment above.) – David Schwartz Mar 14 '17 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.