1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright 2003 Andries E. Brouwer (aeb@cwi.nl)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH ALLOC_HUGEPAGES 2 2007-05-31 "Linux" "Linux Programmer's Manual"
27 alloc_hugepages, free_hugepages \- allocate or free huge pages
30 .BI "void *alloc_hugepages(int " key ", void *" addr ", size_t " len ,
31 .BI " int " prot ", int " flag );
32 .\" asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr,
33 .\" unsigned long len, int prot, int flag);
35 .BI "int free_hugepages(void *" addr );
36 .\" asmlinkage int sys_free_hugepages(unsigned long addr);
40 .BR alloc_hugepages ()
43 were introduced in Linux 2.5.36 and removed again in 2.5.54.
44 They existed only on i386 and ia64 (when built with CONFIG_HUGETLB_PAGE).
45 In Linux 2.4.20 the syscall numbers exist,
46 but the calls fail with the error
49 On i386 the memory management hardware knows about ordinary pages (4 KiB)
50 and huge pages (2 or 4 MiB).
51 Similarly ia64 knows about huge pages of
53 These system calls serve to map huge pages into the
54 process's memory or to free them again.
55 Huge pages are locked into memory, and are not swapped.
59 parameter is an identifier.
60 When zero the pages are private, and
61 not inherited by children.
62 When positive the pages are shared with other applications using the same
64 and inherited by child processes.
70 tells which page is being freed: it was the return value of a
72 .BR alloc_hugepages ().
73 (The memory is first actually freed when all users have released it.)
77 .BR alloc_hugepages ()
78 is a hint, that the kernel may or may not follow.
79 Addresses must be properly aligned.
83 parameter is the length of the required segment.
84 It must be a multiple of the huge page size.
88 parameter specifies the memory protection of the segment.
89 It is one of PROT_READ, PROT_WRITE, PROT_EXEC.
93 parameter is ignored, unless
98 is IPC_CREAT, then a new huge page segment is created when none
99 with the given key existed.
100 If this flag is not set, then ENOENT
101 is returned when no segment with the given key exists.
105 .BR alloc_hugepages ()
106 returns the allocated virtual address, and
107 .BR free_hugepages ()
109 On error, \-1 is returned, and
111 is set appropriately.
115 The system call is not supported on this kernel.
117 .I /proc/sys/vm/nr_hugepages
118 Number of configured hugetlb pages.
119 This can be read and written.
122 Gives info on the number of configured hugetlb pages and on their size
123 in the three variables HugePages_Total, HugePages_Free, Hugepagesize.
125 These calls are specific to Linux on Intel processors, and should not be
126 used in programs intended to be portable.
128 These system calls are gone;
129 they existed only in Linux 2.5.36 through to 2.5.54.
130 Now the hugetlbfs filesystem can be used instead.
131 Memory backed by huge pages (if the CPU supports them) is obtained by
134 to map files in this virtual filesystem.
136 The maximal number of huge pages can be specified using the
140 .\" requires CONFIG_HUGETLB_PAGE (under "Processor type and features")
141 .\" and CONFIG_HUGETLBFS (under "Filesystems").
142 .\" mount -t hugetlbfs hugetlbfs /huge