Commit 5876700c authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

[PATCH] do __unhash_process() under ->siglock

This patch moves __unhash_process() call from realease_task() to
__exit_signal(), so __detach_pid() is called with ->siglock held.

This means we don't need tasklist_lock to iterate over thread group anymore:

	copy_process() was already changed to do attach_pid()
	under ->siglock.

	Eric's "pidhash-kill-switch_exec_pids.patch" from -mm
	changed de_thread() so it doesn't touch PIDTYPE_TGID.

NOTE: de_thread() still needs some attention.  It still changes task->pid
lockless.  Taking ->sighand.siglock here allows to do more tasklist_lock
removals.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 35f5cad8
...@@ -112,6 +112,8 @@ static void __exit_signal(struct task_struct *tsk) ...@@ -112,6 +112,8 @@ static void __exit_signal(struct task_struct *tsk)
sig = NULL; /* Marker for below. */ sig = NULL; /* Marker for below. */
} }
__unhash_process(tsk);
tsk->signal = NULL; tsk->signal = NULL;
cleanup_sighand(tsk); cleanup_sighand(tsk);
spin_unlock(&sighand->siglock); spin_unlock(&sighand->siglock);
...@@ -140,8 +142,6 @@ void release_task(struct task_struct * p) ...@@ -140,8 +142,6 @@ void release_task(struct task_struct * p)
BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children)); BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children));
__exit_signal(p); __exit_signal(p);
__unhash_process(p);
/* /*
* If we are the last non-leader member of the thread * If we are the last non-leader member of the thread
* group, and the leader is zombie, then notify the * group, and the leader is zombie, then notify the
......
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