[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20061022155735.GA10491@oleg>
Date: Sun, 22 Oct 2006 19:57:35 +0400
From: Oleg Nesterov <oleg@...sign.ru>
To: Andrew Morton <akpm@...l.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Alan Cox <alan@...hat.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] do_task_stat: don't take tty_mutex
Depends on
tty-signal-tty-locking.patch
->signal->tty is protected by ->siglock, no need to take the global tty_mutex.
Signed-off-by: Oleg Nesterov <oleg@...sign.ru>
--- rc2-mm2/fs/proc/array.c~ 2006-10-22 19:28:17.000000000 +0400
+++ rc2-mm2/fs/proc/array.c 2006-10-22 19:45:52.000000000 +0400
@@ -346,20 +346,13 @@ static int do_task_stat(struct task_stru
sigemptyset(&sigcatch);
cutime = cstime = utime = stime = cputime_zero;
- mutex_lock(&tty_mutex);
rcu_read_lock();
if (lock_task_sighand(task, &flags)) {
struct signal_struct *sig = task->signal;
- struct tty_struct *tty = sig->tty;
- if (tty) {
- /*
- * sig->tty is not stable, but tty_mutex
- * protects us from release_dev(tty)
- */
- barrier();
- tty_pgrp = tty->pgrp;
- tty_nr = new_encode_dev(tty_devnum(tty));
+ if (sig->tty) {
+ tty_pgrp = sig->tty->pgrp;
+ tty_nr = new_encode_dev(tty_devnum(sig->tty));
}
num_threads = atomic_read(&sig->count);
@@ -395,7 +388,6 @@ static int do_task_stat(struct task_stru
unlock_task_sighand(task, &flags);
}
rcu_read_unlock();
- mutex_unlock(&tty_mutex);
if (!whole || num_threads<2)
wchan = get_wchan(task);
-
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