Skip to content

Commit d5dbac8

Browse files
Nishanth AravamudanLinus Torvalds
authored andcommitted
Documentation: update hugetlb information
The hugetlb documentation has gotten a bit out of sync with the current code. Updated the sysctl file to refer to Documentation/vm/hugetlbpage.txt. Update that file to contain the current state of affairs (with the newer named sysctl in place). Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Acked-by: Adam Litke <agl@us.ibm.com> Cc: William Lee Irwin III <wli@holomorphy.com> Cc: Dave Hansen <haveblue@us.ibm.com> Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 368d2c6 commit d5dbac8

2 files changed

Lines changed: 48 additions & 6 deletions

File tree

‎Documentation/sysctl/vm.txt‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Currently, these files are in /proc/sys/vm:
3434
- oom_kill_allocating_task
3535
- mmap_min_address
3636
- numa_zonelist_order
37+
- nr_hugepages
38+
- nr_overcommit_hugepages
3739

3840
==============================================================
3941

@@ -305,3 +307,20 @@ will select "node" order in following case.
305307

306308
Otherwise, "zone" order will be selected. Default order is recommended unless
307309
this is causing problems for your system/application.
310+
311+
==============================================================
312+
313+
nr_hugepages
314+
315+
Change the minimum size of the hugepage pool.
316+
317+
See Documentation/vm/hugetlbpage.txt
318+
319+
==============================================================
320+
321+
nr_overcommit_hugepages
322+
323+
Change the maximum size of the hugepage pool. The maximum is
324+
nr_hugepages + nr_overcommit_hugepages.
325+
326+
See Documentation/vm/hugetlbpage.txt

‎Documentation/vm/hugetlbpage.txt‎

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ alignment and size of the arguments to the above system calls.
3030
The output of "cat /proc/meminfo" will have lines like:
3131

3232
.....
33-
HugePages_Total: xxx
34-
HugePages_Free: yyy
35-
HugePages_Rsvd: www
33+
HugePages_Total: vvv
34+
HugePages_Free: www
35+
HugePages_Rsvd: xxx
36+
HugePages_Surp: yyy
3637
Hugepagesize: zzz kB
3738

3839
where:
@@ -42,6 +43,10 @@ allocated.
4243
HugePages_Rsvd is short for "reserved," and is the number of hugepages
4344
for which a commitment to allocate from the pool has been made, but no
4445
allocation has yet been made. It's vaguely analogous to overcommit.
46+
HugePages_Surp is short for "surplus," and is the number of hugepages in
47+
the pool above the value in /proc/sys/vm/nr_hugepages. The maximum
48+
number of surplus hugepages is controlled by
49+
/proc/sys/vm/nr_overcommit_hugepages.
4550

4651
/proc/filesystems should also show a filesystem of type "hugetlbfs" configured
4752
in the kernel.
@@ -71,7 +76,25 @@ or failure of allocation depends on the amount of physically contiguous
7176
memory that is preset in system at this time. System administrators may want
7277
to put this command in one of the local rc init files. This will enable the
7378
kernel to request huge pages early in the boot process (when the possibility
74-
of getting physical contiguous pages is still very high).
79+
of getting physical contiguous pages is still very high). In either
80+
case, adminstrators will want to verify the number of hugepages actually
81+
allocated by checking the sysctl or meminfo.
82+
83+
/proc/sys/vm/nr_overcommit_hugepages indicates how large the pool of
84+
hugepages can grow, if more hugepages than /proc/sys/vm/nr_hugepages are
85+
requested by applications. echo'ing any non-zero value into this file
86+
indicates that the hugetlb subsystem is allowed to try to obtain
87+
hugepages from the buddy allocator, if the normal pool is exhausted. As
88+
these surplus hugepages go out of use, they are freed back to the buddy
89+
allocator.
90+
91+
Caveat: Shrinking the pool via nr_hugepages while a surplus is in effect
92+
will allow the number of surplus huge pages to exceed the overcommit
93+
value, as the pool hugepages (which must have been in use for a surplus
94+
hugepages to be allocated) will become surplus hugepages. As long as
95+
this condition holds, however, no more surplus huge pages will be
96+
allowed on the system until one of the two sysctls are increased
97+
sufficiently, or the surplus huge pages go out of use and are freed.
7598

7699
If the user applications are going to request hugepages using mmap system
77100
call, then it is required that system administrator mount a file system of
@@ -94,8 +117,8 @@ provided on command line then no limits are set. For size and nr_inodes
94117
options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For
95118
example, size=2K has the same meaning as size=2048.
96119

97-
read and write system calls are not supported on files that reside on hugetlb
98-
file systems.
120+
While read system calls are supported on files that reside on hugetlb
121+
file systems, write system calls are not.
99122

100123
Regular chown, chgrp, and chmod commands (with right permissions) could be
101124
used to change the file attributes on hugetlbfs.

0 commit comments

Comments
 (0)