[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <488FCC14.3070208@openvz.org>
Date: Wed, 30 Jul 2008 06:04:04 +0400
From: Pavel Emelyanov <xemul@...nvz.org>
To: David Howells <dhowells@...hat.com>
CC: Oleg Nesterov <oleg@...sign.ru>, jmorris@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: Request for documentation of PID handling functions
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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists