+ mm-reintroduce-and-deprecate-rlimit-based-access-for-shm_hugetlb.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     mm: reintroduce and deprecate rlimit based access for SHM_HUGETLB
has been added to the -mm tree.  Its filename is
     mm-reintroduce-and-deprecate-rlimit-based-access-for-shm_hugetlb.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 ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: mm: reintroduce and deprecate rlimit based access for SHM_HUGETLB
From: Ravikiran G Thirumalai <kiran@xxxxxxxxxxxx>

Allow non root users with sufficient mlock rlimits to be able to allocate
hugetlb backed shm for now.  Deprecate this though.  This is being
deprecated because the mlock based rlimit checks for SHM_HUGETLB is not
consistent with mmap based huge page allocations.

Signed-off-by: Ravikiran Thirumalai <kiran@xxxxxxxxxxxx>
Reviewed-by: Mel Gorman <mel@xxxxxxxxx>
Cc: William Lee Irwin III <wli@xxxxxxxxxxxxxx>
Cc: Adam Litke <agl@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 Documentation/feature-removal-schedule.txt |   12 ++++++++++++
 fs/hugetlbfs/inode.c                       |   13 +++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff -puN Documentation/feature-removal-schedule.txt~mm-reintroduce-and-deprecate-rlimit-based-access-for-shm_hugetlb Documentation/feature-removal-schedule.txt
--- a/Documentation/feature-removal-schedule.txt~mm-reintroduce-and-deprecate-rlimit-based-access-for-shm_hugetlb
+++ a/Documentation/feature-removal-schedule.txt
@@ -284,6 +284,18 @@ Who:	Vlad Yasevich <vladislav.yasevich@h
 
 ---------------------------
 
+What:	Ability for non root users to shm_get hugetlb pages based on mlock
+	resource limits
+When:	2.6.31
+Why:	Non root users need to be part of /proc/sys/vm/hugetlb_shm_group or
+	have CAP_IPC_LOCK to be able to allocate shm segments backed by
+	huge pages.  The mlock based rlimit check to allow shm hugetlb is
+	inconsistent with mmap based allocations.  Hence it is being
+	deprecated.
+Who:	Ravikiran Thirumalai <kiran@xxxxxxxxxxxx>
+
+---------------------------
+
 What:	CONFIG_THERMAL_HWMON
 When:	January 2009
 Why:	This option was introduced just to allow older lm-sensors userspace
diff -puN fs/hugetlbfs/inode.c~mm-reintroduce-and-deprecate-rlimit-based-access-for-shm_hugetlb fs/hugetlbfs/inode.c
--- a/fs/hugetlbfs/inode.c~mm-reintroduce-and-deprecate-rlimit-based-access-for-shm_hugetlb
+++ a/fs/hugetlbfs/inode.c
@@ -949,6 +949,7 @@ static int can_do_hugetlb_shm(void)
 struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag)
 {
 	int error = -ENOMEM;
+	int unlock_shm = 0;
 	struct file *file;
 	struct inode *inode;
 	struct dentry *dentry, *root;
@@ -958,8 +959,14 @@ struct file *hugetlb_file_setup(const ch
 	if (!hugetlbfs_vfsmount)
 		return ERR_PTR(-ENOENT);
 
-	if (!can_do_hugetlb_shm())
-		return ERR_PTR(-EPERM);
+	if (!can_do_hugetlb_shm()) {
+		if (user_shm_lock(size, user)) {
+			unlock_shm = 1;
+			WARN_ONCE(1,
+			  "Using mlock ulimits for SHM_HUGETLB deprecated\n");
+		} else
+			return ERR_PTR(-EPERM);
+	}
 
 	root = hugetlbfs_vfsmount->mnt_root;
 	quick_string.name = name;
@@ -999,6 +1006,8 @@ out_inode:
 out_dentry:
 	dput(dentry);
 out_shm_unlock:
+	if (unlock_shm)
+		user_shm_unlock(size, user);
 	return ERR_PTR(error);
 }
 
_

Patches currently in -mm which might be from kiran@xxxxxxxxxxxx are

linux-next.patch
mm-fix-shm_hugetlb-to-work-with-users-in-hugetlb_shm_group.patch
mm-reintroduce-and-deprecate-rlimit-based-access-for-shm_hugetlb.patch
slab-leaks3-default-y.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux