linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@openvz.org>
To: David Howells <dhowells@redhat.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>,
	jmorris@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: Request for documentation of PID handling functions
Date: Wed, 30 Jul 2008 06:04:04 +0400	[thread overview]
Message-ID: <488FCC14.3070208@openvz.org> (raw)
In-Reply-To: <21590.1217285986@redhat.com>

David Howells wrote:
> Hi Pavel,
> 
> Can you please provide documentation for the PID handling functions you
> supplied in commit:
> 
> 	7af5729474b5b8ad385adadab78d6e723e7655a3
> 
> In particular I'd like to know what locks are required when.  I'm trying to
> determine if in this piece of code:
> 
> 		read_lock(&tasklist_lock);
> 		ret = 0;
> 		if (pid != task_pid_vnr(current))
> 			ret = -EPERM;
> 		read_unlock(&tasklist_lock);
> 
> the lock of tasklist_lock is necessary.

The RCU protection is enough to get pids from tasks. However, the pids
are detached under the tasklist lock write-locked, so provided you're
*already* sitting under it the RCU is excessive.

However, Oleg pointed me out some time ago, that in some cases RCU-only
protection was not enough in some cases, so I put him in Cc.

> David
> 


  reply	other threads:[~2008-07-30  2:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-28 22:59 Request for documentation of PID handling functions David Howells
2008-07-30  2:04 ` Pavel Emelyanov [this message]
2008-07-30  9:56   ` Oleg Nesterov

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=488FCC14.3070208@openvz.org \
    --to=xemul@openvz.org \
    --cc=dhowells@redhat.com \
    --cc=jmorris@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    /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).