[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1432575949.6866.43.camel@odin.com>
Date: Mon, 25 May 2015 20:45:49 +0300
From: Kirill Tkhai <ktkhai@...n.com>
To: <linux-kernel@...r.kernel.org>
CC: Oleg Nesterov <oleg@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...hat.com>,
"Peter Zijlstra" <peterz@...radead.org>,
Michal Hocko <mhocko@...e.cz>,
"Rik van Riel" <riel@...hat.com>,
Ionut Alexa <ionut.m.alexa@...il.com>,
Peter Hurley <peter@...leysoftware.com>,
Kirill Tkhai <tkhai@...dex.ru>
Subject: [PATCH RFC 10/13] exit: Add struct wait_opts's member held_lock and
use it for tasklist_lock
These will be used in next patches.
Signed-off-by: Kirill Tkhai <ktkhai@...n.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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists