diff options
author | David Rientjes <rientjes@google.com> | 2015-04-15 19:14:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 19:35:19 -0400 |
commit | 80d6b94bd69a7a49b52bf503ef6a841f43cf5bbb (patch) | |
tree | ae701bac5add788e58774bb009f3a335e072eee2 /Documentation | |
parent | ae7efa507dee4813ec4bcdadebeec191e247d0c9 (diff) |
mm, doc: cleanup and clarify munmap behavior for hugetlb memory
munmap(2) of hugetlb memory requires a length that is hugepage aligned,
otherwise it may fail. Add this to the documentation.
This also cleans up the documentation and separates it into logical units:
one part refers to MAP_HUGETLB and another part refers to requirements for
shared memory segments.
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Joern Engel <joern@logfs.org>
Cc: Jianguo Wu <wujianguo@huawei.com>
Cc: Eric B Munson <emunson@akamai.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/vm/hugetlbpage.txt | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt index b32b9cd50c0e..030977fb8d2d 100644 --- a/Documentation/vm/hugetlbpage.txt +++ b/Documentation/vm/hugetlbpage.txt | |||
@@ -302,15 +302,23 @@ file systems, write system calls are not. | |||
302 | Regular chown, chgrp, and chmod commands (with right permissions) could be | 302 | Regular chown, chgrp, and chmod commands (with right permissions) could be |
303 | used to change the file attributes on hugetlbfs. | 303 | used to change the file attributes on hugetlbfs. |
304 | 304 | ||
305 | 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 |
306 | 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 |
307 | 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 |
308 | should be a member of a supplementary group and system admin needs to | 308 | below. |
309 | configure that gid into /proc/sys/vm/hugetlb_shm_group. It is possible for | 309 | |
310 | 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 |
311 | 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 |
312 | 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 |
313 | 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 | |||
314 | 322 | ||
315 | Examples | 323 | Examples |
316 | ======== | 324 | ======== |