mmap.2: Document MAP_HUGE_2MB, MAP_HUGE_1GB, and MAP_HUGE_SHIFT

Reported-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2015-05-06 17:29:50 +02:00
parent 651b8a8257
commit 5d2038b6a8
1 changed files with 28 additions and 0 deletions

View File

@ -232,6 +232,34 @@ See the Linux kernel source file
.I Documentation/vm/hugetlbpage.txt
for further information.
.TP
.BR MAP_HUGE_2MB ", " MAP_HUGE_1GB " (since Linux 3.8)"
.\" See https://lwn.net/Articles/533499/
Used in conjunction with
.B MAP_HUGETLB
to select alternative hugetlb page sizes (respectively, 2 MB and 1 GB)
on systems that support multiple hugetlb page sizes.
More generally, the desired huge page size can be configured by encoding
the base-2 logarithm of the desired page size in the six bits at the offset
.BR MAP_HUGE_SHIFT .
(A value of zero in this bit field provides the default huge page size;
the default huge page size can be discovered vie the
.I Hugepagesize
field exposed by
.IR /proc/meminfo .)
Thus, the above two constants are defined as:
.nf
.in +4n
#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT)
#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT)
.in
.fi
The range of huge page sizes that are supported by the system
can be discovered by listing the subdirectories in
.IR /sys/kernel/mm/hugepages .
.TP
.BR MAP_LOCKED " (since Linux 2.5.37)"
Lock the pages of the mapped region into memory in the manner of
.BR mlock (2).