Skip to contentSkip to conversation

cleanup next_tid()

PATCH New Oleg Nesterov 1 participant 1 message Mar 19, 2006 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cleanup next_tid()

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

fs/proc/base.c renamed from fs/proc/base.c~ +8 -8
@@ -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;