1 .\" Copyright 2003 Andries E. Brouwer (aeb@cwi.nl)
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .TH alloc_hugepages 2 (date) "Linux man-pages (unreleased)"
7 alloc_hugepages, free_hugepages \- allocate or free huge pages
10 .BI "void *syscall(SYS_alloc_hugepages, int " key ", void " addr [. len "], \
12 .BI " int " prot ", int " flag );
13 .\" asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr,
14 .\" unsigned long len, int prot, int flag);
15 .BI "int syscall(SYS_free_hugepages, void *" addr );
16 .\" asmlinkage int sys_free_hugepages(unsigned long addr);
20 glibc provides no wrappers for these system calls,
21 necessitating the use of
25 .BR alloc_hugepages ()
28 were introduced in Linux 2.5.36 and removed again in Linux 2.5.54.
29 They existed only on i386 and ia64 (when built with
30 .BR CONFIG_HUGETLB_PAGE ).
31 In Linux 2.4.20, the syscall numbers exist,
32 but the calls fail with the error
35 On i386 the memory management hardware knows about ordinary pages (4\ KiB)
36 and huge pages (2 or 4\ MiB).
37 Similarly ia64 knows about huge pages of
39 These system calls serve to map huge pages into the
40 process's memory or to free them again.
41 Huge pages are locked into memory, and are not swapped.
45 argument is an identifier.
46 When zero the pages are private, and
47 not inherited by children.
48 When positive the pages are shared with other applications using the same
50 and inherited by child processes.
56 tells which page is being freed: it was the return value of a
58 .BR alloc_hugepages ().
59 (The memory is first actually freed when all users have released it.)
63 .BR alloc_hugepages ()
64 is a hint, that the kernel may or may not follow.
65 Addresses must be properly aligned.
69 argument is the length of the required segment.
70 It must be a multiple of the huge page size.
74 argument specifies the memory protection of the segment.
82 argument is ignored, unless
89 then a new huge page segment is created when none
90 with the given key existed.
91 If this flag is not set, then
93 is returned when no segment with the given key exists.
96 .BR alloc_hugepages ()
97 returns the allocated virtual address, and
100 On error, \-1 is returned, and
102 is set to indicate the error.
106 The system call is not supported on this kernel.
109 .I /proc/sys/vm/nr_hugepages
110 Number of configured hugetlb pages.
111 This can be read and written.
114 Gives info on the number of configured hugetlb pages and on their size
115 in the three variables HugePages_Total, HugePages_Free, Hugepagesize.
117 These extinct system calls were specific to Linux on Intel processors.
119 These system calls are gone;
120 they existed only in Linux 2.5.36 through to Linux 2.5.54.
121 Now the hugetlbfs filesystem can be used instead.
122 Memory backed by huge pages (if the CPU supports them) is obtained by
125 to map files in this virtual filesystem.
127 The maximal number of huge pages can be specified using the
131 .\" requires CONFIG_HUGETLB_PAGE (under "Processor type and features")
132 .\" and CONFIG_HUGETLBFS (under "Filesystems").
133 .\" mount \-t hugetlbfs hugetlbfs /huge