Commit 62dfb554 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

[PATCH] session_of_pgrp: kill unnecessary do_each_task_pid(PIDTYPE_PGID)

All members of the process group have the same sid and it can't be == 0.

NOTE: this code (and a similar one in sys_setpgid) was needed because it
was possibe to have ->session == 0. It's not possible any longer since

	[PATCH] pidhash: don't use zero pids
	Commit: c7c64641

Signed-off-by: default avatarOleg Nesterov <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent f020bc46
......@@ -189,19 +189,16 @@ repeat:
int session_of_pgrp(int pgrp)
struct task_struct *p;
int sid = -1;
int sid = 0;
do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
if (process_session(p) > 0) {
sid = process_session(p);
goto out;
} while_each_task_pid(pgrp, PIDTYPE_PGID, p);
p = find_task_by_pid_type(PIDTYPE_PGID, pgrp);
if (p == NULL)
p = find_task_by_pid(pgrp);
if (p)
if (p != NULL)
sid = process_session(p);
return sid;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment