From 8f5f33a7fd66e85d8d8502b5ee9c1c731ff0aeb5 Mon Sep 17 00:00:00 2001 From: Hong-Mei Li Date: Mon, 1 Jun 2015 18:58:42 -0700 Subject: fs: avoid adding non-thread-group task to LMK rbtree To maintain the task adj RB tree, we add a task to the RB tree when fork, and delete it when exit. The place is exactly the same as the linear p->tasks list, say, nly when the task is thread_group_leader. When task group_leader is changing, we make sure to add the new leader into RB tree after its leader flag is set, task->exit_signal. Cherry-picked from (CR): http://gerrit.mot.com/753419/ Change-Id: I8da47998510e531188feb067b491e92306be9414 Signed-off-by: Hong-Mei Li Reviewed-on: http://gerrit.mot.com/753419 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Zhi-Ming Yuan Reviewed-by: Yi-Wei Zhao Submit-Approved: Jira Key Reviewed-on: http://gerrit.mot.com/766106 Reviewed-by: Sudharsan Yettapu Reviewed-by: Ravikumar Vembu (cherry picked from commit e9e92d64142625981490dd5c323aa08467d349e8) Reviewed-on: http://gerrit.mot.com/768301 Conflicts: fs/exec.c --- fs/exec.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'fs/exec.c') diff --git a/fs/exec.c b/fs/exec.c index 807400fd9f4..f0d744a455d 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -963,6 +963,15 @@ static int de_thread(struct task_struct *tsk) leader->group_leader = tsk; tsk->exit_signal = SIGCHLD; + /* + * need to delete leader from adj tree, because it will not be + * group leader (exit_signal = -1) soon. release_task(leader) + * can't delete it. + */ + spin_lock_irq(lock); + delete_from_adj_tree(leader); + add_2_adj_tree(tsk); + spin_unlock_irq(lock); BUG_ON(leader->exit_state != EXIT_ZOMBIE); leader->exit_state = EXIT_DEAD; -- cgit v1.2.3