From: ebiederm@xmission.com (Eric W. Biederman)
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Howells <dhowells@redhat.com>,
Oleg Nesterov <oleg@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
paulmck@linux.vnet.ibm.com, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
Jiri Olsa <jolsa@redhat.com>
Subject: Re: [PATCH 2/2] CRED: Fix __task_cred()'s lockdep check and banner comment
Date: Thu, 05 Aug 2010 13:13:03 -0700 [thread overview]
Message-ID: <m1zkx04y40.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <AANLkTikavQKkvmdY5=8jh8KSV7vit=WcmDHWjnZfVWnv@mail.gmail.com> (Linus Torvalds's message of "Thu\, 5 Aug 2010 09\:14\:50 -0700")
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Thu, Aug 5, 2010 at 12:19 AM, Eric W. Biederman
> <ebiederm@xmission.com> wrote:
>>
>> No. When we send a signal to multiple processes it needs to be an
>> atomic operation so that kill -KILL -pgrp won't let processes escape.
>> It is what posix specifies, it is what real programs expect, and it
>> is the useful semantic in userspace.
>
> Ok. However, in that case, it's not really about the whole list
> traversal, it's a totally separate thing, and it's really sad that we
> end up using the (rather hot) tasklist_lock for something like that.
> With the dcache/inode locks basically going away, I think
> tasklist_lock ends up being one of the few hot locks left.
It is about the list traversal. In the process group case it is about
traversing the pid->tasks[PIDTYPE_PGID] hlist, which is also protected
by the tasklist_lock.
> Wouldn't it be much nicer to:
> - make it clear that all the "real" signal locking can rely on RCU
> - use a separate per-pgrp lock that ends up being the one that gives
> the signal _semantic_ meaning?
>
> That would automatically document why we get the lock too, which
> certainly isn't clear from the code as-is.
>
> The per-pgrp lock might be something as simple as a silly hash that
> just spreads out the process groups over some random number of simple
> spinlocks.
I think it is totally reasonable to add a per pid lock,
that would protect the pid->task[...] hlist. That would make
things clearer and finer grained without a lot of effort. Just
a little more struct pid bloat, and a little extra care in fork,
when we add to those lists.
Even with the per-pgrp lock we still need a lock on the global process
list for the kill -KILL -1 case. Which suggests that tasklist_lock is
still needed for part of kill_something_info.
Eric
next prev parent reply other threads:[~2010-08-05 20:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-29 11:45 [PATCH 1/2] CRED: Fix get_task_cred() and task_state() to not resurrect dead credentials David Howells
2010-07-29 11:45 ` [PATCH 2/2] CRED: Fix __task_cred()'s lockdep check and banner comment David Howells
2010-08-02 20:40 ` Paul E. McKenney
2010-08-03 0:55 ` Tetsuo Handa
2010-08-03 9:34 ` David Howells
2010-08-03 16:07 ` Linus Torvalds
2010-08-03 17:48 ` Thomas Gleixner
2010-08-04 13:17 ` Oleg Nesterov
2010-08-04 14:01 ` David Howells
2010-08-04 15:08 ` Oleg Nesterov
2010-08-04 15:22 ` David Howells
2010-08-04 15:44 ` Oleg Nesterov
2010-08-05 7:19 ` Eric W. Biederman
2010-08-05 16:14 ` Linus Torvalds
2010-08-05 18:16 ` Oleg Nesterov
2010-08-05 20:13 ` Eric W. Biederman [this message]
2010-08-05 20:26 ` Linus Torvalds
2010-08-05 21:20 ` Eric W. Biederman
2010-08-04 0:38 ` Tetsuo Handa
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=m1zkx04y40.fsf@fess.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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