linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: David Rientjes <rientjes@google.com>
Cc: Dave Jones <davej@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] mm, hugetlb: add thread name and pid to SHM_HUGETLB mlock rlimit warning
Date: Thu, 8 Mar 2012 12:02:38 -0800	[thread overview]
Message-ID: <20120308120238.c4486547.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.DEB.2.00.1203061825070.9015@chino.kir.corp.google.com>

On Tue, 6 Mar 2012 18:26:11 -0800 (PST)
David Rientjes <rientjes@google.com> wrote:

> Add the thread name and pid of the application that is allocating shm
> segments with MAP_HUGETLB without being a part of
> /proc/sys/vm/hugetlb_shm_group or having CAP_IPC_LOCK.
> 
> This identifies the application so it may be fixed by avoiding using the
> deprecated exception (see Documentation/feature-removal-schedule.txt).
> 
> ...
>
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -946,7 +946,11 @@ struct file *hugetlb_file_setup(const char *name, size_t size,
>  	if (creat_flags == HUGETLB_SHMFS_INODE && !can_do_hugetlb_shm()) {
>  		*user = current_user();
>  		if (user_shm_lock(size, *user)) {
> -			printk_once(KERN_WARNING "Using mlock ulimits for SHM_HUGETLB is deprecated\n");
> +			task_lock(current);
> +			printk_once(KERN_WARNING
> +				"%s (%d): Using mlock ulimits for SHM_HUGETLB is deprecated\n",
> +				current->comm, current->pid);
> +			task_unlock(current);

I assume the task_lock() is there to protect current->comm.  If so, it
is unneeded - we're protecting against prctl(PR_SET_NAME), and
PR_SET_NAME only operates on current, and we know this task isn't
currently running PR_SET_NAME.

If there's a way for another task to alter this task's ->comm then we
_do_ need locking.  But there isn't a way, I hope.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-03-08 20:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07  2:26 [patch] mm, hugetlb: add thread name and pid to SHM_HUGETLB mlock rlimit warning David Rientjes
2012-03-08 20:02 ` Andrew Morton [this message]
2012-03-08 21:37   ` David Rientjes
2012-03-08 21:56     ` Andrew Morton
2012-03-08 22:08       ` David Rientjes
2012-03-08 22:23         ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120308120238.c4486547.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).