[PATCH] cleanup next_tid()

From: Oleg Nesterov
Date: Sun Mar 19 2006 - 14:27:15 EST


This patch tries to make next_tid() a bit more readable
and deletes unnecessary "pid_alive(pos)" check.

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>

--- MM/fs/proc/base.c~ 2006-03-20 00:02:08.000000000 +0300
+++ MM/fs/proc/base.c 2006-03-20 00:52:02.000000000 +0300
@@ -2215,15 +2215,15 @@ out:
*/
static struct task_struct *next_tid(struct task_struct *start)
{
- struct task_struct *pos;
+ struct task_struct *pos = NULL;
rcu_read_lock();
- pos = start;
- if (pid_alive(start))
- pos = next_thread(start);
- if (pid_alive(pos) && (pos != start->group_leader))
- get_task_struct(pos);
- else
- pos = NULL;
+ if (pid_alive(start)) {
+ pos = next_thread(start);
+ if (thread_group_leader(pos))
+ pos = NULL;
+ else
+ get_task_struct(pos);
+ }
rcu_read_unlock();
put_task_struct(start);
return pos;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/