linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH Vx RESEND] mm,hugetlb: remove mlock ulimit for SHM_HUGETLB
@ 2021-09-04  7:54 zhangyiru
  2021-09-07 20:52 ` Mike Kravetz
  0 siblings, 1 reply; 3+ messages in thread
From: zhangyiru @ 2021-09-04  7:54 UTC (permalink / raw)
  To: mike.kravetz; +Cc: linux-mm, wuxu.wu, liusirui, zhangyiru3

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

Signed-off-by: zhangyiru <zhangyiru3@huawei.com>
---
 fs/hugetlbfs/inode.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index cdfb1ae78a3f..c092c4931c3e 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -1463,18 +1463,8 @@ struct file *hugetlb_file_setup(const char *name, size_t size,
 	if (!mnt)
 		return ERR_PTR(-ENOENT);
 
-	if (creat_flags == HUGETLB_SHMFS_INODE && !can_do_hugetlb_shm()) {
-		*ucounts = current_ucounts();
-		if (user_shm_lock(size, *ucounts)) {
-			task_lock(current);
-			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);
-		}
-	}
+	if (creat_flags == HUGETLB_SHMFS_INODE && !can_do_hugetlb_shm())
+		return ERR_PTR(-EPERM);
 
 	file = ERR_PTR(-ENOSPC);
 	inode = hugetlbfs_get_inode(mnt->mnt_sb, NULL, S_IFREG | S_IRWXUGO, 0);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH Vx RESEND] mm,hugetlb: remove mlock ulimit for SHM_HUGETLB
  2021-09-04  7:54 [PATCH Vx RESEND] mm,hugetlb: remove mlock ulimit for SHM_HUGETLB zhangyiru
@ 2021-09-07 20:52 ` Mike Kravetz
  2021-09-15 23:55   ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Kravetz @ 2021-09-07 20:52 UTC (permalink / raw)
  To: zhangyiru; +Cc: linux-mm, wuxu.wu, liusirui, Andrew Morton, Michal Hocko

On 9/4/21 12:54 AM, zhangyiru wrote:
> 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

A better commit to mention would be 2584e517320b ("mm: reintroduce and
deprecate rlimit based access for SHM_HUGETLB").  IIUC, 21a3c273f88c just
modified the log message.

There is nothing wrong with the code.  Adding Andrew and Michal on Cc:
as I have little or no experience with removing deprecated
features/code.  This certainly has been marked deprecated for a long
time (since 2.6.31).  However, I still see that message in log files on
occasion.

Andrew/Michal, comments?
-- 
Mike Kravetz

> 
> Signed-off-by: zhangyiru <zhangyiru3@huawei.com>
> ---
>  fs/hugetlbfs/inode.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index cdfb1ae78a3f..c092c4931c3e 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -1463,18 +1463,8 @@ struct file *hugetlb_file_setup(const char *name, size_t size,
>  	if (!mnt)
>  		return ERR_PTR(-ENOENT);
>  
> -	if (creat_flags == HUGETLB_SHMFS_INODE && !can_do_hugetlb_shm()) {
> -		*ucounts = current_ucounts();
> -		if (user_shm_lock(size, *ucounts)) {
> -			task_lock(current);
> -			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);
> -		}
> -	}
> +	if (creat_flags == HUGETLB_SHMFS_INODE && !can_do_hugetlb_shm())
> +		return ERR_PTR(-EPERM);
>  
>  	file = ERR_PTR(-ENOSPC);
>  	inode = hugetlbfs_get_inode(mnt->mnt_sb, NULL, S_IFREG | S_IRWXUGO, 0);
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH Vx RESEND] mm,hugetlb: remove mlock ulimit for SHM_HUGETLB
  2021-09-07 20:52 ` Mike Kravetz
@ 2021-09-15 23:55   ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2021-09-15 23:55 UTC (permalink / raw)
  To: Mike Kravetz; +Cc: zhangyiru, linux-mm, wuxu.wu, liusirui, Michal Hocko

On Tue, 7 Sep 2021 13:52:04 -0700 Mike Kravetz <mike.kravetz@oracle.com> wrote:

> On 9/4/21 12:54 AM, zhangyiru wrote:
> > 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
> 
> A better commit to mention would be 2584e517320b ("mm: reintroduce and
> deprecate rlimit based access for SHM_HUGETLB").  IIUC, 21a3c273f88c just
> modified the log message.

I made that change to the changelog.

> There is nothing wrong with the code.  Adding Andrew and Michal on Cc:
> as I have little or no experience with removing deprecated
> features/code.  This certainly has been marked deprecated for a long
> time (since 2.6.31).

I'd have thought that emitting a nasty message for a decade would suffice.

>  However, I still see that message in log files on
> occasion.

However I appear to be wrong :(

A quick web search indicates that people were reporting this in 2020,
at least.  So I don't think we can remove it.

otoh, one report was against RHEL3 which went end-of-life in 2015.  So
perhaps some more research on this will end up making the justifiable.

I dunno, I'm just waffling.  Maybe just merge it and if someone
complains, they can't say they weren't warned!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-15 23:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-04  7:54 [PATCH Vx RESEND] mm,hugetlb: remove mlock ulimit for SHM_HUGETLB zhangyiru
2021-09-07 20:52 ` Mike Kravetz
2021-09-15 23:55   ` Andrew Morton

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