Re: [PATCH] Add the max_usage member on the res_counter

Pavel Emelyanov
2008-03-12T09:05:16Z

Andrew Morton wrote:
> On Tue, 11 Mar 2008 17:55:46 +0300 Pavel Emelyanov <xemul@openvz.org> wrote:
>
>> This field is the maximal value of the usage one since the counter
>> creation (or since the latest reset).
>>
>> To reset this to the usage value simply write anything to the
>> appropriate cgroup file.
>
> What is the justification for making this change? Why do we need it?

The max_usage value is useful when gathering a statistical information
about the particular group, as it shows the actual memory requirements
for a particular group, not just some usage snapshot.

E.g. this value can be used to quickly tune the group. OpenVZ users often
set the limits to maximal values and either load the container with a common
patterns or leave one for a while. After this the max_usage value shows the
amount of memory the container would require during its common activity.
Setting the limit a bit above this value gives a pretty good configuration,
that works in the most cases.

But, please see my second comment.

> Please provide this information for all patches where it is not obvious.
>
>> {
>> + .name = "max_usage_in_bytes",
>> + .private = RES_MAX_USAGE,
>> + .write = mem_cgroup_max_reset,
>> + .read_u64 = mem_cgroup_read,
>> + },
>
> Documentation/controllers/memory.txt needs updating.
>

I'm preparing the Documentation/controllers/resource_counter.txt file
that will describe this abstraction. Since this one can be used for
many other resources (swap, kernel memory, networking, etc) this will
also eliminate all the possible future duplications in the appropriate
docs.

The above explanation of the max_usage attribute will be included in
this doc. Should it still be included in the previous patch's comment or
in the patch _as_a_ comment?