Skip to contentSkip to conversation

mm,hugetlb: remove mlock ulimit for SHM_HUGETLB

PATCH RESEND Superseded zhangyiru 3 participants 3 messages Oct 8, 2021 – Oct 11, 2021

Subsystems (2)

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

zhangyiru

author
#0 lore raw

PATCH RESEND v2 1/1 mm,hugetlb: remove mlock ulimit for SHM_HUGETLB

commit 21a3c273f88c9cbbaf7e ("mm, hugetlb: add thread name and pid to SHM_HUGETLB mlock rlimit warning") marked this as deprecated in 2012, but it is not deleted yet.

Mike says he still see that message in log files on occasion, so maybe we should preserve this warning.

---
Changelog:
v2: preserve warning message
v1: remove mlock ulimit for SHM_HUGETLB

---
 fs/hugetlbfs/inode.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/hugetlbfs/inode.c +2 -3
index cdfb1ae78a3f..877d0ce9526c 100644
@@ -1470,10 +1470,9 @@ struct file *hugetlb_file_setup(const char *name, size_t size,
 			pr_warn_once("%s (%d): Using mlock ulimits for SHM_HUGETLB is deprecated\n",
 				current->comm, current->pid);
 			task_unlock(current);
-		} else {
-			*ucounts = NULL;
-			return ERR_PTR(-EPERM);
 		}
+		*ucounts = NULL;
+		return ERR_PTR(-EPERM);
 	}
 
 	file = ERR_PTR(-ENOSPC);
Signature · 1 line
2.27.0
#1 lore raw
Quoted 21 lines · zhangyiru

commit 21a3c273f88c9cbbaf7e ("mm, hugetlb: add thread name and pid to SHM_HUGETLB mlock rlimit warning") marked this as deprecated in 2012, but it is not deleted yet.

Mike says he still see that message in log files on occasion, so maybe we should preserve this warning.

---
Changelog:
v2: preserve warning message
v1: remove mlock ulimit for SHM_HUGETLB

---
 fs/hugetlbfs/inode.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/hugetlbfs/inode.c +0 -0
index cdfb1ae78a3f..877d0ce9526c 100644

fs/hugetlbfs/inode.c struct file *hugetlb_file_setup(const char *name, size_t size, · line 1475

Quoted 9 lines
fs/hugetlbfs/inode.c +2 -3
@@ -1470,10 +1470,9 @@ struct file *hugetlb_file_setup(const char *name, size_t size,
 			pr_warn_once("%s (%d): Using mlock ulimits for SHM_HUGETLB is deprecated\n",
 				current->comm, current->pid);
 			task_unlock(current);
-		} else {
-			*ucounts = NULL;
-			return ERR_PTR(-EPERM);
 		}
+		*ucounts = NULL;
+		return ERR_PTR(-EPERM);

IIUC, deprecated means that use of the feature is discouraged but technically still available. With this patch, we use the term deprecated and also remove the functionality. Perhaps change the warning to be the following?

pr_warn_once("%s (%d): Using mlock ulimits for SHM_HUGETLB is now obsolete\n",

Leaving the 'deprecated' message and removing the functionality may confuse people if their application breaks after this patch.

Signature · 1 line
Mike Kravetz
#2 lore raw
Quoted 37 lines · Mike Kravetz
Quoted 21 lines · zhangyiru

commit 21a3c273f88c9cbbaf7e ("mm, hugetlb: add thread name and pid to SHM_HUGETLB mlock rlimit warning") marked this as deprecated in 2012, but it is not deleted yet.

Mike says he still see that message in log files on occasion, so maybe we should preserve this warning.

---
Changelog:
v2: preserve warning message
v1: remove mlock ulimit for SHM_HUGETLB

---
 fs/hugetlbfs/inode.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/hugetlbfs/inode.c +0 -0
index cdfb1ae78a3f..877d0ce9526c 100644

fs/hugetlbfs/inode.c struct file *hugetlb_file_setup(const char *name, size_t size, · line 1475

Quoted 9 lines
fs/hugetlbfs/inode.c +2 -3
@@ -1470,10 +1470,9 @@ struct file *hugetlb_file_setup(const char *name, size_t size,
 			pr_warn_once("%s (%d): Using mlock ulimits for SHM_HUGETLB is deprecated\n",
 				current->comm, current->pid);
 			task_unlock(current);
-		} else {
-			*ucounts = NULL;
-			return ERR_PTR(-EPERM);
 		}
+		*ucounts = NULL;
+		return ERR_PTR(-EPERM);

IIUC, deprecated means that use of the feature is discouraged but technically still available. With this patch, we use the term deprecated and also remove the functionality. Perhaps change the warning to be the following?

Quoted 1 line

pr_warn_once("%s (%d): Using mlock ulimits for SHM_HUGETLB is now obsolete\n",

Agreed. I would even go with an addition "Please report if you have a usecase for this functionality."

Quoted 4 lines

Leaving the 'deprecated' message and removing the functionality may confuse people if their application breaks after this patch.

Signature · 1 line
Mike Kravetz
Signature · 2 lines
Michal Hocko
SUSE Labs