mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cleanup next_tid()
@ 2006-03-19 19:26 Oleg Nesterov
  0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2006-03-19 19:26 UTC (permalink / raw)
  To: Eric W. Biederman, Andrew Morton; +Cc: linux-kernel

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

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-19 19:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-19 19:26 [PATCH] cleanup next_tid() Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®