aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavikiran G Thirumalai <kiran@scalex86.org>2009-03-31 18:21:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:12 -0400
commit2584e517320bd48dc8d20e38a2621a2dbe58fade (patch)
tree3b94b6c4cc10ab16ab106464e8d32e2e77ad8634
parent8a0bdec194c21c8fdef840989d0d7b742bb5d4bc (diff)
mm: reintroduce and deprecate rlimit based access for SHM_HUGETLB
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@scalex86.org> Reviewed-by: Mel Gorman <mel@csn.ul.ie> Cc: William Lee Irwin III <wli@holomorphy.com> Cc: Adam Litke <agl@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/feature-removal-schedule.txt12
-rw-r--r--fs/hugetlbfs/inode.c13
2 files changed, 23 insertions, 2 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 5e02b83ac12b..ea7d1bdad34d 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -311,6 +311,18 @@ Who: Vlad Yasevich <vladislav.yasevich@hp.com>
311 311
312--------------------------- 312---------------------------
313 313
314What: Ability for non root users to shm_get hugetlb pages based on mlock
315 resource limits
316When: 2.6.31
317Why: Non root users need to be part of /proc/sys/vm/hugetlb_shm_group or
318 have CAP_IPC_LOCK to be able to allocate shm segments backed by
319 huge pages. The mlock based rlimit check to allow shm hugetlb is
320 inconsistent with mmap based allocations. Hence it is being
321 deprecated.
322Who: Ravikiran Thirumalai <kiran@scalex86.org>
323
324---------------------------
325
314What: CONFIG_THERMAL_HWMON 326What: CONFIG_THERMAL_HWMON
315When: January 2009 327When: January 2009
316Why: This option was introduced just to allow older lm-sensors userspace 328Why: This option was introduced just to allow older lm-sensors userspace
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index bc56df8ce001..23a3c76711e0 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -949,6 +949,7 @@ static int can_do_hugetlb_shm(void)
949struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag) 949struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag)
950{ 950{
951 int error = -ENOMEM; 951 int error = -ENOMEM;
952 int unlock_shm = 0;
952 struct file *file; 953 struct file *file;
953 struct inode *inode; 954 struct inode *inode;
954 struct dentry *dentry, *root; 955 struct dentry *dentry, *root;
@@ -958,8 +959,14 @@ struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag)
958 if (!hugetlbfs_vfsmount) 959 if (!hugetlbfs_vfsmount)
959 return ERR_PTR(-ENOENT); 960 return ERR_PTR(-ENOENT);
960 961
961 if (!can_do_hugetlb_shm()) 962 if (!can_do_hugetlb_shm()) {
962 return ERR_PTR(-EPERM); 963 if (user_shm_lock(size, user)) {
964 unlock_shm = 1;
965 WARN_ONCE(1,
966 "Using mlock ulimits for SHM_HUGETLB deprecated\n");
967 } else
968 return ERR_PTR(-EPERM);
969 }
963 970
964 root = hugetlbfs_vfsmount->mnt_root; 971 root = hugetlbfs_vfsmount->mnt_root;
965 quick_string.name = name; 972 quick_string.name = name;
@@ -999,6 +1006,8 @@ out_inode:
999out_dentry: 1006out_dentry:
1000 dput(dentry); 1007 dput(dentry);
1001out_shm_unlock: 1008out_shm_unlock:
1009 if (unlock_shm)
1010 user_shm_unlock(size, user);
1002 return ERR_PTR(error); 1011 return ERR_PTR(error);
1003} 1012}
1004 1013