mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + mmap-allow-map_hugetlb-for-hugetlbfs-files-v2.patch added to -mm tree
@ 2013-06-28 22:03 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2013-06-28 22:03 UTC (permalink / raw)
  To: mm-commits, wujianguo, joern

Subject: + mmap-allow-map_hugetlb-for-hugetlbfs-files-v2.patch added to -mm tree
To: joern@logfs.org,wujianguo@huawei.com
From: akpm@linux-foundation.org
Date: Fri, 28 Jun 2013 15:03:30 -0700


The patch titled
     Subject: mmap: allow MAP_HUGETLB for hugetlbfs files v2
has been added to the -mm tree.  Its filename is
     mmap-allow-map_hugetlb-for-hugetlbfs-files-v2.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: =?utf-8?B?SsO2cm4=?= Engel <joern@logfs.org>
Subject: mmap: allow MAP_HUGETLB for hugetlbfs files v2

It is counterintuitive at best that mmap'ing a hugetlbfs file with
MAP_HUGETLB fails, while mmap'ing it without will a) succeed and b)
return huge pages.
v2: use is_file_hugepages(), as suggested by Jianguo

Signed-off-by: Joern Engel <joern@logfs.org>
Cc: Jianguo Wu <wujianguo@huawei.com>
---
 1 file changed, 4 insertions(+), 2 deletions(-)

index 2a594246..cdc8e7a 100644
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/mmap.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff -puN mm/mmap.c~mmap-allow-map_hugetlb-for-hugetlbfs-files-v2 mm/mmap.c
--- a/mm/mmap.c~mmap-allow-map_hugetlb-for-hugetlbfs-files-v2
+++ a/mm/mmap.c
@@ -1358,13 +1358,14 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned lon
 
 	if (!(flags & MAP_ANONYMOUS)) {
 		audit_mmap_fd(fd, flags);
-		if (unlikely(flags & MAP_HUGETLB))
-			return -EINVAL;
 		file = fget(fd);
 		if (!file)
 			goto out;
 		if (is_file_hugepages(file))
 			len = ALIGN(len, huge_page_size(hstate_file(file)));
+		retval = -EINVAL;
+		if (unlikely(flags & MAP_HUGETLB && !is_file_hugepages(file)))
+			goto out_fput;
 	} else if (flags & MAP_HUGETLB) {
 		struct user_struct *user = NULL;
 		struct hstate *hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) &
@@ -1391,6 +1392,7 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned lon
 	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
 
 	retval = vm_mmap_pgoff(file, addr, len, prot, flags, pgoff);
+out_fput:
 	if (file)
 		fput(file);
 out:
_

Patches currently in -mm which might be from joern@logfs.org are

linux-next.patch
hugetlb-properly-account-rss.patch
mmap-allow-map_hugetlb-for-hugetlbfs-files-v2.patch
nilfs2-implement-calculation-of-free-inodes-count.patch
nilfs2-use-atomic64_t-type-for-inodes_count-and-blocks_count-fields-in-nilfs_root-struct.patch
selftests-exit-1-on-failure.patch
self-test-fix-make-clean.patch
selftests-add-hugetlbfstest.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-06-28 22:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28 22:03 + mmap-allow-map_hugetlb-for-hugetlbfs-files-v2.patch added to -mm tree akpm

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).