[PATCH] cleanup next_tid()
authorOleg Nesterov <oleg@tv-sign.ru>
Mon, 26 Jun 2006 07:26:02 +0000 (00:26 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 26 Jun 2006 16:58:26 +0000 (09:58 -0700)
Try to make next_tid() a bit more readable and deletes unnecessary
"pid_alive(pos)" check.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/proc/base.c

index 5ee46d3a5cac711741c0b9b2944a468d860ddacc..43871c85729d8255ea25966e0611c84f35f4d66a 100644 (file)
@@ -2267,15 +2267,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))
+       if (pid_alive(start)) {
                pos = next_thread(start);
-       if (pid_alive(pos) && (pos != start->group_leader))
-               get_task_struct(pos);
-       else
-               pos = NULL;
+               if (thread_group_leader(pos))
+                       pos = NULL;
+               else
+                       get_task_struct(pos);
+       }
        rcu_read_unlock();
        put_task_struct(start);
        return pos;