Bug 60991 - [TRIVIAL]Formula of CommitLimit is wrong
Summary: [TRIVIAL]Formula of CommitLimit is wrong
Status: RESOLVED CODE_FIX
Alias: None
Product: Documentation
Classification: Unclassified
Component: man-pages (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: documentation_man-pages@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-08 16:37 UTC by sworddragon2
Modified: 2016-03-24 15:43 UTC (History)
4 users (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description sworddragon2 2013-09-08 16:37:51 UTC
The documentation on https://www.kernel.org/doc/Documentation/filesystems/proc.txt says: "The CommitLimit is calculated with the following formula:
              CommitLimit = ('vm.overcommit_ratio' * Physical RAM) + Swap"

Variables on my system:
vm.overcommit_ratio = 50
Physical RAM = 16 GiB
SwapTotal = 16776188 KiB

/proc/meminfo says "CommitLimit:    24993316 kB". Now lets see if this is correct: CommitLimit = (50 * 16777216 KiB) + 16776188 KiB; CommitLimit = 855636988 KiB. The result from the formula does not match with the value reported by the kernel.

It is more likely that 'vm.overcommit_ratio' must be devided by 100 and "Physical RAM" must be replaced by the available memory (reported on my system as "MemTotal:       16434260 kB"). The new formula looks this: CommitLimit = ('vm.overcommit_ratio' / 100 * 'MemTotal') + 'SwapTotal'. The result will be: CommitLimit = (50 / 100 * 16434260 KiB) + 16776188 KiB; CommitLimit = 24993318 KiB. There is a difference of 2 KiB to the reported value but maybe this comes from internal rounding.
Comment 1 Michael Kerrisk 2013-12-30 07:23:08 UTC
You're right that the documentation is wrong. I've updated the proc(5) man page with the correct formula:

CommitLimit = ([total RAM pages] - [total huge TLB pages]) * 
               overcommit_ratio / 100 + [total swap pages]

(See the kernel source file fs/proc/meminfo.c.)
Comment 2 sakshi.april5 2014-05-28 04:51:32 UTC
Hello,

I am beginner and would like to fix this bug. Is it still open?
Comment 3 Michael Kerrisk 2014-05-28 13:05:55 UTC
Resolved a while ago; should have been closed already.
Comment 4 sworddragon2 2014-05-28 23:04:35 UTC
The online documentation does still contain the old formula, does it maybe get always updated at a later time?
Comment 5 Michael Kerrisk 2014-05-29 05:28:03 UTC
Which online documentation? You can see the update at
http://man7.org/linux/man-pages/man5/proc.5.html
Comment 6 sworddragon2 2014-05-29 19:58:42 UTC
I was referring to the link I have posted in the startpost: https://www.kernel.org/doc/Documentation/filesystems/proc.txt

I'm still seeing the old formula there.
Comment 7 Michael Kerrisk 2014-05-30 12:58:16 UTC
Okay -- sorry, that bug still remains then. Reopening.
Comment 8 sakshi.april5 2014-06-02 06:52:22 UTC
I lookied into the man pages and the change has been updated there.
So we need to make changes in the following file:
https://www.kernel.org/doc/Documentation/filesystems/proc.txt

Where can I get to download the code for that?
Comment 9 sakshi.april5 2014-06-06 05:41:55 UTC
I lookied into the man pages and the change has been updated there.
So we need to make changes in the following file:
https://www.kernel.org/doc/Documentation/filesystems/proc.txt

Where can I get to download the code for that?
Comment 10 Martin Kepplinger 2016-03-21 12:09:46 UTC
should be closed as I see it.

Note You need to log in before you can comment on or make changes to this bug.