Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751628AbbEYRp6 (ORCPT ); Mon, 25 May 2015 13:45:58 -0400 Received: from relay.parallels.com ([195.214.232.42]:44328 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750903AbbEYRpy (ORCPT ); Mon, 25 May 2015 13:45:54 -0400 Message-ID: <1432575949.6866.43.camel@odin.com> Subject: [PATCH RFC 10/13] exit: Add struct wait_opts's member held_lock and use it for tasklist_lock From: Kirill Tkhai To: CC: Oleg Nesterov , Andrew Morton , Ingo Molnar , "Peter Zijlstra" , Michal Hocko , "Rik van Riel" , Ionut Alexa , Peter Hurley , Kirill Tkhai Date: Mon, 25 May 2015 20:45:49 +0300 In-Reply-To: <20150525162722.5171.15901.stgit@pro> References: <20150525162722.5171.15901.stgit@pro> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.30.16.109] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1982 Lines: 71 These will be used in next patches. Signed-off-by: Kirill Tkhai --- 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) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/