Lines Matching refs:the
3 the Linux kernel. This support is built on top of multiple page size support
13 Users can use the huge page support in Linux kernel by either using the mmap
16 First the Linux kernel needs to be built with the CONFIG_HUGETLBFS
21 The /proc/meminfo file provides information about the total number of
22 persistent hugetlb pages in the kernel's huge page pool. It also displays
23 information about the number of free, reserved and surplus huge pages and the
24 default huge page size. The huge page size is needed for generating the
25 proper alignment and size of the arguments to system calls that map huge page
38 HugePages_Total is the size of the pool of huge pages.
39 HugePages_Free is the number of huge pages in the pool that are not yet
41 HugePages_Rsvd is short for "reserved," and is the number of huge pages for
42 which a commitment to allocate from the pool has been made,
45 huge page from the pool of huge pages at fault time.
46 HugePages_Surp is short for "surplus," and is the number of huge pages in
47 the pool above the value in /proc/sys/vm/nr_hugepages. The
52 in the kernel.
54 /proc/sys/vm/nr_hugepages indicates the current number of "persistent" huge
55 pages in the kernel's huge page pool. "Persistent" huge pages will be
56 returned to the huge page pool when freed by a task. A user with root
58 by increasing or decreasing the value of 'nr_hugepages'.
60 Pages that are used as huge pages are reserved inside the kernel and cannot
64 Once a number of huge pages have been pre-allocated to the kernel huge page
65 pool, a user with appropriate privilege can use either the mmap system call
66 or shared memory system calls to use the huge pages. See the discussion of
69 The administrator can allocate persistent huge pages on the kernel boot
70 command line by specifying the "hugepages=N" parameter, where 'N' = the
71 number of huge pages requested. This is the most reliable method of
75 of a specific size, one must precede the huge pages boot command parameters
78 page size may be selected with the "default_hugepagesz=<size>" boot parameter.
81 indicates the current number of pre-allocated huge pages of the default size.
82 Thus, one can use the following command to dynamically allocate/deallocate
87 This command will try to adjust the number of default sized huge pages in the
90 On a NUMA platform, the kernel will attempt to distribute the huge page pool
91 over all the set of allowed nodes specified by the NUMA memory policy of the
92 task that modifies nr_hugepages. The default for the allowed nodes--when the
95 silently skipped when allocating persistent huge pages. See the discussion
96 below of the interaction of task memory policy, cpusets and per node attributes
97 with the allocation and freeing of persistent huge pages.
99 The success or failure of huge page allocation depends on the amount of
100 physically contiguous memory that is present in system at the time of the
101 allocation attempt. If the kernel is unable to allocate huge pages from
102 some nodes in a NUMA system, it will attempt to make up the difference by
106 System administrators may want to put this command in one of the local rc
107 init files. This will enable the kernel to allocate huge pages early in
108 the boot process when the possibility of getting physical contiguous pages
109 is still very high. Administrators can verify the number of huge pages
110 actually allocated by checking the sysctl or meminfo. To check the per node
115 /proc/sys/vm/nr_overcommit_hugepages specifies how large the pool of
118 indicates that the hugetlb subsystem is allowed to try to obtain that
119 number of "surplus" huge pages from the kernel's normal page pool, when the
121 unused, they are freed back to the kernel's normal page pool.
123 When increasing the huge page pool size via nr_hugepages, any existing surplus
126 the new persistent huge page pool size.
128 The administrator may shrink the pool of persistent huge pages for
129 the default huge page size by setting the nr_hugepages sysctl to a
130 smaller value. The kernel will attempt to balance the freeing of huge pages
131 across all nodes in the memory policy of the task modifying nr_hugepages.
132 Any free huge pages on the selected nodes will be freed back to the kernel's
135 Caveat: Shrinking the persistent huge page pool via nr_hugepages such that
136 it becomes less than the number of huge pages in use will convert the balance
137 of the in-use huge pages to surplus huge pages. This will occur even if
138 the number of surplus pages it would exceed the overcommit value. As long as
140 increased sufficiently, or the surplus huge pages go out of use and are freed--
144 the huge page userspace interface in /proc/sys/vm has been duplicated in sysfs.
150 For each huge page size supported by the running kernel, a subdirectory
151 will exist, of the form:
155 Inside each of these directories, the same set of files will exist:
164 which function as described above for the default huge page-sized case.
170 Whether huge pages are allocated and freed via the /proc interface or
171 the /sysfs interface using the nr_hugepages_mempolicy attribute, the NUMA
172 nodes from which huge pages are allocated or freed are controlled by the
173 NUMA memory policy of the task that modifies the nr_hugepages_mempolicy
174 sysctl or attribute. When the nr_hugepages attribute is used, mempolicy
177 The recommended method to allocate or free huge pages to/from the kernel
178 huge page pool, using the nr_hugepages example above, is:
187 This will allocate or free abs(20 - nr_hugepages) to or from the nodes
190 allocated nor freed on any node not included in the specified <node-list>.
192 When adjusting the persistent hugepage count via nr_hugepages_mempolicy, any
197 persistent huge pages will be distributed across the node or nodes
198 specified in the mempolicy as if "interleave" had been specified.
199 However, if a node in the policy does not contain sufficient contiguous
200 memory for a huge page, the allocation will not "fallback" to the nearest
202 undesirable imbalance in the distribution of the huge page pool, or
204 the task's memory policy.
206 2) One or more nodes may be specified with the bind or interleave policy.
207 If more than one node is specified with the preferred policy, only the
208 lowest numeric id will be used. Local policy will select the node where
209 the task is running at the time the nodes_allowed mask is constructed.
210 For local policy to be deterministic, the task must be bound to a cpu or
211 cpus in a single node. Otherwise, the task could be migrated to some
212 other node at any time after launch and the resulting node will be
214 Any of the other mempolicy modes may be used to specify a single node.
217 whether this policy was set explicitly by the task itself or one of its
218 ancestors, such as numactl. This means that if the task is invoked from a
221 interleaving over all nodes in the system or cpuset.
224 the resource limits of any cpuset in which the task runs. Thus, there will
226 subset of the system nodes to allocate huge pages outside the cpuset
227 without first moving to a cpuset that contains all of the desired nodes.
229 5) Boot-time huge page allocation attempts to distribute the requested number
235 A subset of the contents of the root huge page control directory in sysfs,
236 described above, will be replicated under each the system device of each
241 Under this directory, the subdirectory for each supported huge page size
242 contains the following attribute files:
248 The free_' and surplus_' attribute files are read-only. They return the number
249 of free and surplus [overcommitted] huge pages, respectively, on the parent
252 The nr_hugepages attribute returns the total number of huge pages on the
253 specified node. When this attribute is written, the number of persistent huge
254 pages on the parent node will be adjusted to the specified value, if sufficient
255 resources exist, regardless of the task's mempolicy or cpuset constraints.
257 Note that the number of overcommit and reserve pages remain global quantities,
258 as we don't know until fault time, when the faulting task's mempolicy is
259 applied, from which node the huge page allocation will be attempted.
265 If the user applications are going to request huge pages using mmap system
273 This command mounts a (pseudo) filesystem of type hugetlbfs on the directory
275 options sets the owner and group of the root of the file system. By default
276 the uid and gid of the current process are taken. The mode option sets the
278 By default the value 0755 is picked. If the paltform supports multiple huge
279 page sizes, the pagesize option can be used to specify the huge page size and
281 the paltform's default huge page size and associated pool will be used. The
282 size option sets the maximum value of memory (huge pages) allowed for that
284 percentage of the specified huge page pool (nr_hugepages). The size is
285 rounded down to HPAGE_SIZE boundary. The min_size option sets the minimum
286 value of memory (huge pages) allowed for the filesystem. min_size can be
287 specified in the same way as size, either bytes or a percentage of the
288 huge page pool. At mount time, the number of huge pages specified by
289 min_size are reserved for use by the filesystem. If there are not enough
290 free huge pages available, the mount will fail. As huge pages are allocated
291 to the filesystem and freed, the reserve count is adjusted so that the sum
293 nr_inodes sets the maximum number of inodes that /mnt/huge can use. If the
297 has the same meaning as size=2048.
303 used to change the file attributes on hugetlbfs.
313 applications to use any combination of mmaps and shm* calls, though the mount of
317 aligned to the native page size of the processor; they will normally fail with
318 errno set to EINVAL or exclude hugetlb pages that extend beyond the length if
320 a hugetlb page and the length is smaller than the hugepage size.
339 The most complete set of hugetlb tests are in the libhugetlbfs repository.
340 If you modify any hugetlb related code, use the libhugetlbfs test suite