public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Pavel Emelyanov <xemul@openvz.org>
Cc: Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Sukadev Bhattiprolu <sukadev@us.ibm.com>,
	devel@openvz.org
Subject: Re: [PATCH] Isolate some explicit usage of task->tgid
Date: Fri, 17 Aug 2007 18:48:13 +0400	[thread overview]
Message-ID: <20070817144813.GA347@tv-sign.ru> (raw)
In-Reply-To: <46C5AD92.70909@openvz.org>

On 08/17, Pavel Emelyanov wrote:
>
> Actually the p->tgid == pid has to be changed to has_group_leader_pid(), 
> but Oleg pointed out that this is the same and thread_group_leader() 
> is more preferable. 

No, no, sorry for confusion! I was not clear. I meant that thread_group_leader()
is imho better for posix timers, but

> @@ -865,8 +865,8 @@ static int de_thread(struct task_struct 
> 
> 		write_lock_irq(&tasklist_lock);
> 
> -		BUG_ON(leader->tgid != tsk->tgid);
> -		BUG_ON(tsk->pid == tsk->tgid);
> +		BUG_ON(!same_thread_group(leader, tsk));
> +		BUG_ON(thread_group_leader(tsk));

This should be has_group_leader_pid(), BUG_ON() really checks that
we didn't confuse ->tgid's.

> 		/*
> 		 * An exec() starts a new thread group with the
> 		 * TGID of the previous thread group. Rehash the
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index e3009ab..31e7dfe 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -2288,7 +2288,7 @@ retry:
> 		 * found doesn't happen to be a thread group leader.
> 		 * As we don't care in the case of readdir.
> 		 */
> -		if (!task || !has_group_leader_pid(task))
> +		if (!task || !thread_group_leader(task))

And this _must_ be has_group_leader_pid(), this was actually the reason
to introduce the "has_group_leader_pid()" helper.

Otherwise I think the patch is fine, and the new helper is really useful.

Oleg.


  reply	other threads:[~2007-08-17 14:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-17 14:15 [PATCH] Isolate some explicit usage of task->tgid Pavel Emelyanov
2007-08-17 14:48 ` Oleg Nesterov [this message]
2007-08-17 14:54   ` Pavel Emelyanov

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=20070817144813.GA347@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=devel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sukadev@us.ibm.com \
    --cc=xemul@openvz.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