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

Oleg Nesterov oleg at tv-sign.ru
Fri Aug 17 06:51:37 PDT 2007


On 08/17, Pavel Emelyanov wrote:
>
> diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
> index b53c8fc..06a1e7d 100644
> --- a/kernel/posix-cpu-timers.c
> +++ b/kernel/posix-cpu-timers.c
> @@ -21,8 +21,8 @@ static int check_clock(const clockid_t w
> 
> 	read_lock(&tasklist_lock);
> 	p = find_task_by_pid(pid);
> -	if (!p || (CPUCLOCK_PERTHREAD(which_clock) ?
> -		   p->tgid != current->tgid : p->tgid != pid)) {
> +	if (!p || !(CPUCLOCK_PERTHREAD(which_clock) ?
> +		   same_thread_group(p, current) : has_group_leader_pid(p)))

Could you use thread_group_leader() instead of has_group_leader_pid() for
posix timers?

This is what the code means, and it is a bit faster. has_group_leader_pid()
is a bit special, and imho should be avoided.

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

Oleg.




More information about the Devel mailing list