Re: [PATCH] Isolate some explicit usage of task->tgid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux