From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: a.p.zijlstra@chello.nl
Cc: mingo@elte.hu, john.stultz@linaro.org,
linux-kernel@vger.kernel.org, joe@perches.com, mina86@mina86.com,
apw@canonical.com, jirislaby@gmail.com, rientjes@google.com,
dave@linux.vnet.ibm.com, akpm@linux-foundation.org,
linux-mm@kvack.org
Subject: Re: [PATCH 1/3] comm: Introduce comm_lock spinlock to protect task->comm access
Date: Wed, 18 May 2011 09:53:16 +0900 [thread overview]
Message-ID: <4DD3187C.3050408@jp.fujitsu.com> (raw)
In-Reply-To: <1305669256.2466.6286.camel@twins>
(2011/05/18 6:54), Peter Zijlstra wrote:
> On Tue, 2011-05-17 at 23:27 +0200, Ingo Molnar wrote:
>> * John Stultz<john.stultz@linaro.org> wrote:
>>
>>> The implicit rules for current->comm access being safe without locking are no
>>> longer true. Accessing current->comm without holding the task lock may result
>>> in null or incomplete strings (however, access won't run off the end of the
>>> string).
>>
>> This is rather unfortunate - task->comm is used in a number of performance
>> critical codepaths such as tracing.
>>
>> Why does this matter so much? A NULL string is not a big deal.
>>
>> Note, since task->comm is 16 bytes there's the CMPXCHG16B instruction on x86
>> which could be used to update it atomically, should atomicity really be
>> desired.
>
> The changelog also fails to mention _WHY_ this is no longer true. Nor
> does it treat why making it true again isn't an option.
>
> Who is changing another task's comm? That's just silly.
I'm not sure it's silly or not. But the fact is, comm override was introduced
following patch. Personally I'd like to mark it to "depend on EXPERT". but John
seems to dislike the idea.
commit 4614a696bd1c3a9af3a08f0e5874830a85b889d4
Author: john stultz <johnstul@us.ibm.com>
Date: Mon Dec 14 18:00:05 2009 -0800
procfs: allow threads to rename siblings via /proc/pid/tasks/tid/comm
WARNING: multiple messages have this Message-ID (diff)
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: a.p.zijlstra@chello.nl
Cc: mingo@elte.hu, john.stultz@linaro.org,
linux-kernel@vger.kernel.org, joe@perches.com, mina86@mina86.com,
apw@canonical.com, jirislaby@gmail.com, rientjes@google.com,
dave@linux.vnet.ibm.com, akpm@linux-foundation.org,
linux-mm@kvack.org
Subject: Re: [PATCH 1/3] comm: Introduce comm_lock spinlock to protect task->comm access
Date: Wed, 18 May 2011 09:53:16 +0900 [thread overview]
Message-ID: <4DD3187C.3050408@jp.fujitsu.com> (raw)
In-Reply-To: <1305669256.2466.6286.camel@twins>
(2011/05/18 6:54), Peter Zijlstra wrote:
> On Tue, 2011-05-17 at 23:27 +0200, Ingo Molnar wrote:
>> * John Stultz<john.stultz@linaro.org> wrote:
>>
>>> The implicit rules for current->comm access being safe without locking are no
>>> longer true. Accessing current->comm without holding the task lock may result
>>> in null or incomplete strings (however, access won't run off the end of the
>>> string).
>>
>> This is rather unfortunate - task->comm is used in a number of performance
>> critical codepaths such as tracing.
>>
>> Why does this matter so much? A NULL string is not a big deal.
>>
>> Note, since task->comm is 16 bytes there's the CMPXCHG16B instruction on x86
>> which could be used to update it atomically, should atomicity really be
>> desired.
>
> The changelog also fails to mention _WHY_ this is no longer true. Nor
> does it treat why making it true again isn't an option.
>
> Who is changing another task's comm? That's just silly.
I'm not sure it's silly or not. But the fact is, comm override was introduced
following patch. Personally I'd like to mark it to "depend on EXPERT". but John
seems to dislike the idea.
commit 4614a696bd1c3a9af3a08f0e5874830a85b889d4
Author: john stultz <johnstul@us.ibm.com>
Date: Mon Dec 14 18:00:05 2009 -0800
procfs: allow threads to rename siblings via /proc/pid/tasks/tid/comm
--
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>
next prev parent reply other threads:[~2011-05-18 0:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-17 20:47 [PATCH 0/3] v5 Improve task->comm locking situation John Stultz
2011-05-17 20:47 ` John Stultz
2011-05-17 20:47 ` [PATCH 1/3] comm: Introduce comm_lock spinlock to protect task->comm access John Stultz
2011-05-17 20:47 ` John Stultz
2011-05-17 21:27 ` Ingo Molnar
2011-05-17 21:27 ` Ingo Molnar
2011-05-17 21:54 ` Peter Zijlstra
2011-05-17 21:54 ` Peter Zijlstra
2011-05-17 22:56 ` David Rientjes
2011-05-17 22:56 ` David Rientjes
2011-05-18 0:53 ` KOSAKI Motohiro [this message]
2011-05-18 0:53 ` KOSAKI Motohiro
2011-05-17 22:27 ` John Stultz
2011-05-17 22:27 ` John Stultz
2011-05-18 1:02 ` KOSAKI Motohiro
2011-05-18 1:02 ` KOSAKI Motohiro
2011-05-17 20:47 ` [PATCH 2/3] printk: Add %ptc to safely print a task's comm John Stultz
2011-05-17 20:47 ` John Stultz
2011-05-17 21:42 ` Jiri Slaby
2011-05-17 21:42 ` Jiri Slaby
2011-05-17 21:52 ` Joe Perches
2011-05-17 21:52 ` Joe Perches
2011-05-17 22:04 ` Jiri Slaby
2011-05-17 22:04 ` Jiri Slaby
2011-05-17 22:17 ` Joe Perches
2011-05-17 22:17 ` Joe Perches
2011-05-17 22:17 ` John Stultz
2011-05-17 22:17 ` John Stultz
2011-05-17 20:47 ` [PATCH 3/3] checkpatch.pl: Add check for task comm references John Stultz
2011-05-17 20:47 ` John Stultz
2011-05-17 20:58 ` Jiri Slaby
2011-05-17 20:58 ` Jiri Slaby
2011-05-17 21:04 ` Michal Nazarewicz
2011-05-17 21:04 ` Michal Nazarewicz
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=4DD3187C.3050408@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=dave@linux.vnet.ibm.com \
--cc=jirislaby@gmail.com \
--cc=joe@perches.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mina86@mina86.com \
--cc=mingo@elte.hu \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.