[Devel] [PATCH RHEL7 COMMIT] ub: add heuristic check for memory overcommit

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 17 09:27:01 PDT 2016


Hi Sergey,

On 05/17/2016 06:23 PM, Sergey Korshunoff wrote:
>> If disabled (ubc.overcommit_memory = 1),
>
> It is hard to understand what the variable name mean..
> May be a better variable name is ub_overcommit_enabled?

Well, in fact there is a sysctl in the system "vm.overcommit_memory":
int sysctl_overcommit_memory __read_mostly = OVERCOMMIT_GUESS; /* heuristic overcommit */

So we use same name for the Containers-related "ubc.overcommit_memory" sysctl and the code variable name was also inherited.
Hope that's not that obfuscating. :)

Thank you for looking into this!



============================
Documentation/sysctl/vm.txt:

overcommit_memory:

This value contains a flag that enables memory overcommitment.

When this flag is 0, the kernel attempts to estimate the amount
of free memory left when userspace requests more memory.

When this flag is 1, the kernel pretends there is always enough
memory until it actually runs out.

When this flag is 2, the kernel uses a "never overcommit"
policy that attempts to prevent any overcommit of memory.
Note that user_reserve_kbytes affects this policy.

This feature can be very useful because there are a lot of
programs that malloc() huge amounts of memory "just-in-case"
and don't use much of it.

The default value is 0.


--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team


More information about the Devel mailing list