linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/2] mm, doc: cleanup and clarify munmap behavior for hugetlb memory
@ 2015-03-26 23:23 David Rientjes
  2015-03-26 23:23 ` [patch 2/2] mm, selftests: test return value of munmap for MAP_HUGETLB memory David Rientjes
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: David Rientjes @ 2015-03-26 23:23 UTC (permalink / raw)
  To: Andrew Morton, Jonathan Corbet
  Cc: Davide Libenzi, Luiz Capitulino, Shuah Khan, Hugh Dickins,
	Andrea Arcangeli, Joern Engel, Jianguo Wu, Eric B Munson,
	linux-mm, linux-kernel, linux-api, linux-doc

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>
---
 Documentation/vm/hugetlbpage.txt | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt
--- a/Documentation/vm/hugetlbpage.txt
+++ b/Documentation/vm/hugetlbpage.txt
@@ -289,15 +289,20 @@ file systems, write system calls are not.
 Regular chown, chgrp, and chmod commands (with right permissions) could be
 used to change the file attributes on hugetlbfs.
 
-Also, it is important to note that no such mount command is required if the
+Also, it is important to note that no such mount command is required if
 applications are going to use only shmat/shmget system calls or mmap with
-MAP_HUGETLB.  Users who wish to use hugetlb page via shared memory segment
-should be a member of a supplementary group and system admin needs to
-configure that gid into /proc/sys/vm/hugetlb_shm_group.  It is possible for
-same or different applications to use any combination of mmaps and shm*
-calls, though the mount of filesystem will be required for using mmap calls
-without MAP_HUGETLB.  For an example of how to use mmap with MAP_HUGETLB see
-map_hugetlb.c.
+MAP_HUGETLB.  For an example of how to use mmap with MAP_HUGETLB see map_hugetlb
+below.
+
+Users who wish to use hugetlb memory via shared memory segment should be a
+member of a supplementary group and system admin needs to configure that gid
+into /proc/sys/vm/hugetlb_shm_group.  It is possible for same or different
+applications to use any combination of mmaps and shm* calls, though the mount of
+filesystem will be required for using mmap calls without MAP_HUGETLB.
+
+When using munmap(2) to unmap hugetlb memory, the length specified must be
+hugepage aligned, otherwise it will fail with errno set to EINVAL.
+
 
 Examples
 ========

^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <057a01d06ddd$ff2550e0$fd6ff2a0$@alibaba-inc.com>]

end of thread, other threads:[~2015-04-11 13:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 23:23 [patch 1/2] mm, doc: cleanup and clarify munmap behavior for hugetlb memory David Rientjes
2015-03-26 23:23 ` [patch 2/2] mm, selftests: test return value of munmap for MAP_HUGETLB memory David Rientjes
2015-03-26 23:52   ` Michael Ellerman
2015-03-27 13:58 ` [patch 1/2] mm, doc: cleanup and clarify munmap behavior for hugetlb memory Eric B Munson
2015-03-28  1:37   ` David Rientjes
2015-03-30  1:35 ` Hugh Dickins
2015-03-30 14:23   ` Eric B Munson
2015-03-30 20:23     ` Hugh Dickins
2015-04-02 22:40   ` David Rientjes
2015-04-02 22:50     ` [patch -mm] mm, doc: cleanup and clarify munmap behavior for hugetlb memory fix David Rientjes
2015-04-03  1:05       ` Hugh Dickins
2015-04-04  9:34       ` Jonathan Corbet
2015-04-09 19:46         ` David Rientjes
2015-04-11 13:26           ` Jonathan Corbet
     [not found] <057a01d06ddd$ff2550e0$fd6ff2a0$@alibaba-inc.com>
2015-04-03  7:18 ` Hillf Danton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).