diff options
Diffstat (limited to 'Documentation/vm/hugetlbpage.txt')
-rw-r--r-- | Documentation/vm/hugetlbpage.txt | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt index f2d3a100fe38..030977fb8d2d 100644 --- a/Documentation/vm/hugetlbpage.txt +++ b/Documentation/vm/hugetlbpage.txt | |||
@@ -267,21 +267,34 @@ call, then it is required that system administrator mount a file system of | |||
267 | type hugetlbfs: | 267 | type hugetlbfs: |
268 | 268 | ||
269 | mount -t hugetlbfs \ | 269 | mount -t hugetlbfs \ |
270 | -o uid=<value>,gid=<value>,mode=<value>,size=<value>,nr_inodes=<value> \ | 270 | -o uid=<value>,gid=<value>,mode=<value>,pagesize=<value>,size=<value>,\ |
271 | none /mnt/huge | 271 | min_size=<value>,nr_inodes=<value> none /mnt/huge |
272 | 272 | ||
273 | This command mounts a (pseudo) filesystem of type hugetlbfs on the directory | 273 | This command mounts a (pseudo) filesystem of type hugetlbfs on the directory |
274 | /mnt/huge. Any files created on /mnt/huge uses huge pages. The uid and gid | 274 | /mnt/huge. Any files created on /mnt/huge uses huge pages. The uid and gid |
275 | options sets the owner and group of the root of the file system. By default | 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 | 276 | the uid and gid of the current process are taken. The mode option sets the |
277 | mode of root of file system to value & 01777. This value is given in octal. | 277 | mode of root of file system to value & 01777. This value is given in octal. |
278 | By default the value 0755 is picked. The size option sets the maximum value of | 278 | By default the value 0755 is picked. If the paltform supports multiple huge |
279 | memory (huge pages) allowed for that filesystem (/mnt/huge). The size is | 279 | page sizes, the pagesize option can be used to specify the huge page size and |
280 | rounded down to HPAGE_SIZE. The option nr_inodes sets the maximum number of | 280 | associated pool. pagesize is specified in bytes. If pagesize is not specified |
281 | inodes that /mnt/huge can use. If the size or nr_inodes option is not | 281 | the paltform's default huge page size and associated pool will be used. The |
282 | provided on command line then no limits are set. For size and nr_inodes | 282 | size option sets the maximum value of memory (huge pages) allowed for that |
283 | options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For | 283 | filesystem (/mnt/huge). The size option can be specified in bytes, or as a |
284 | example, size=2K has the same meaning as size=2048. | 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 | ||
292 | of allocated and reserved huge pages is always at least min_size. The option | ||
293 | nr_inodes sets the maximum number of inodes that /mnt/huge can use. If the | ||
294 | size, min_size or nr_inodes option is not provided on command line then | ||
295 | no limits are set. For pagesize, size, min_size and nr_inodes options, you | ||
296 | can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For example, size=2K | ||
297 | has the same meaning as size=2048. | ||
285 | 298 | ||
286 | While read system calls are supported on files that reside on hugetlb | 299 | While read system calls are supported on files that reside on hugetlb |
287 | file systems, write system calls are not. | 300 | file systems, write system calls are not. |
@@ -289,15 +302,23 @@ file systems, write system calls are not. | |||
289 | Regular chown, chgrp, and chmod commands (with right permissions) could be | 302 | Regular chown, chgrp, and chmod commands (with right permissions) could be |
290 | used to change the file attributes on hugetlbfs. | 303 | used to change the file attributes on hugetlbfs. |
291 | 304 | ||
292 | Also, it is important to note that no such mount command is required if the | 305 | Also, it is important to note that no such mount command is required if |
293 | applications are going to use only shmat/shmget system calls or mmap with | 306 | applications are going to use only shmat/shmget system calls or mmap with |
294 | MAP_HUGETLB. Users who wish to use hugetlb page via shared memory segment | 307 | MAP_HUGETLB. For an example of how to use mmap with MAP_HUGETLB see map_hugetlb |
295 | should be a member of a supplementary group and system admin needs to | 308 | below. |
296 | configure that gid into /proc/sys/vm/hugetlb_shm_group. It is possible for | 309 | |
297 | same or different applications to use any combination of mmaps and shm* | 310 | Users who wish to use hugetlb memory via shared memory segment should be a |
298 | calls, though the mount of filesystem will be required for using mmap calls | 311 | member of a supplementary group and system admin needs to configure that gid |
299 | without MAP_HUGETLB. For an example of how to use mmap with MAP_HUGETLB see | 312 | into /proc/sys/vm/hugetlb_shm_group. It is possible for same or different |
300 | map_hugetlb.c. | 313 | applications to use any combination of mmaps and shm* calls, though the mount of |
314 | filesystem will be required for using mmap calls without MAP_HUGETLB. | ||
315 | |||
316 | Syscalls that operate on memory backed by hugetlb pages only have their lengths | ||
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 | ||
319 | not hugepage aligned. For example, munmap(2) will fail if memory is backed by | ||
320 | a hugetlb page and the length is smaller than the hugepage size. | ||
321 | |||
301 | 322 | ||
302 | Examples | 323 | Examples |
303 | ======== | 324 | ======== |