1 .\" Copyright 2003 Andries E. Brouwer (aeb@cwi.nl)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH ALLOC_HUGEPAGES 2 2021-03-22 "Linux" "Linux Programmer's Manual"
27 alloc_hugepages, free_hugepages \- allocate or free huge pages
30 .BI "void *syscall(SYS_alloc_hugepages, int " key ", void *" addr \
32 .BI " int " prot ", int " flag );
33 .\" asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr,
34 .\" unsigned long len, int prot, int flag);
35 .BI "int syscall(SYS_free_hugepages, void *" addr );
36 .\" asmlinkage int sys_free_hugepages(unsigned long addr);
40 glibc provides no wrappers for these system calls,
41 necessitating the use of
45 .BR alloc_hugepages ()
48 were introduced in Linux 2.5.36 and removed again in 2.5.54.
49 They existed only on i386 and ia64 (when built with
50 .BR CONFIG_HUGETLB_PAGE ).
51 In Linux 2.4.20, the syscall numbers exist,
52 but the calls fail with the error
55 On i386 the memory management hardware knows about ordinary pages (4\ KiB)
56 and huge pages (2 or 4\ MiB).
57 Similarly ia64 knows about huge pages of
59 These system calls serve to map huge pages into the
60 process's memory or to free them again.
61 Huge pages are locked into memory, and are not swapped.
65 argument is an identifier.
66 When zero the pages are private, and
67 not inherited by children.
68 When positive the pages are shared with other applications using the same
70 and inherited by child processes.
76 tells which page is being freed: it was the return value of a
78 .BR alloc_hugepages ().
79 (The memory is first actually freed when all users have released it.)
83 .BR alloc_hugepages ()
84 is a hint, that the kernel may or may not follow.
85 Addresses must be properly aligned.
89 argument is the length of the required segment.
90 It must be a multiple of the huge page size.
94 argument specifies the memory protection of the segment.
102 argument is ignored, unless
109 then a new huge page segment is created when none
110 with the given key existed.
111 If this flag is not set, then
113 is returned when no segment with the given key exists.
116 .BR alloc_hugepages ()
117 returns the allocated virtual address, and
118 .BR free_hugepages ()
120 On error, \-1 is returned, and
122 is set to indicate the error.
126 The system call is not supported on this kernel.
129 .I /proc/sys/vm/nr_hugepages
130 Number of configured hugetlb pages.
131 This can be read and written.
134 Gives info on the number of configured hugetlb pages and on their size
135 in the three variables HugePages_Total, HugePages_Free, Hugepagesize.
137 These extinct system calls were specific to Linux on Intel processors.
139 These system calls are gone;
140 they existed only in Linux 2.5.36 through to 2.5.54.
141 Now the hugetlbfs filesystem can be used instead.
142 Memory backed by huge pages (if the CPU supports them) is obtained by
145 to map files in this virtual filesystem.
147 The maximal number of huge pages can be specified using the
151 .\" requires CONFIG_HUGETLB_PAGE (under "Processor type and features")
152 .\" and CONFIG_HUGETLBFS (under "Filesystems").
153 .\" mount \-t hugetlbfs hugetlbfs /huge