Messages in this thread Patch in this message | | | Subject | [PATCH RFC 10/13] exit: Add struct wait_opts's member held_lock and use it for tasklist_lock | From | Kirill Tkhai <> | Date | Mon, 25 May 2015 20:45:49 +0300 |
| |
These will be used in next patches.
Signed-off-by: Kirill Tkhai <ktkhai@odin.com> --- kernel/exit.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/exit.c b/kernel/exit.c index c84f3e4..bb9d165 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -953,6 +953,7 @@ struct wait_opts { wait_queue_t child_wait; int notask_error; + rwlock_t *held_lock; }; static inline @@ -1034,7 +1035,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) int why; get_task_struct(p); - read_unlock(&tasklist_lock); + read_unlock(wo->held_lock); sched_annotate_sleep(); if ((exit_code & 0x7f) == 0) { @@ -1056,7 +1057,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) /* * We own this thread, nobody else can reap it. */ - read_unlock(&tasklist_lock); + read_unlock(wo->held_lock); sched_annotate_sleep(); /* @@ -1246,7 +1247,7 @@ static int wait_task_stopped(struct wait_opts *wo, get_task_struct(p); pid = task_pid_vnr(p); why = ptrace ? CLD_TRAPPED : CLD_STOPPED; - read_unlock(&tasklist_lock); + read_unlock(wo->held_lock); sched_annotate_sleep(); if (unlikely(wo->wo_flags & WNOWAIT)) @@ -1309,7 +1310,7 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p) pid = task_pid_vnr(p); get_task_struct(p); - read_unlock(&tasklist_lock); + read_unlock(wo->held_lock); sched_annotate_sleep(); if (!wo->wo_info) { @@ -1538,6 +1539,7 @@ static long do_wait(struct wait_opts *wo) set_current_state(TASK_INTERRUPTIBLE); read_lock(&tasklist_lock); + wo->held_lock = &tasklist_lock; for_each_thread(current, tsk) { retval = do_wait_thread(wo, tsk); if (retval)
| |