“eb0089d629ba413ebf820733ad11b4b2bed45514”上不存在“io_uring/io_uring.c”
提交 91593504 编写于 作者: O Oleg Nesterov 提交者: Linus Torvalds

[PATCH] do_task_stat(): don't take tty_mutex

->signal->tty is protected by ->siglock, no need to take the global tty_mutex.
Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 24ec839c
...@@ -346,20 +346,13 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) ...@@ -346,20 +346,13 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole)
sigemptyset(&sigcatch); sigemptyset(&sigcatch);
cutime = cstime = utime = stime = cputime_zero; cutime = cstime = utime = stime = cputime_zero;
mutex_lock(&tty_mutex);
rcu_read_lock(); rcu_read_lock();
if (lock_task_sighand(task, &flags)) { if (lock_task_sighand(task, &flags)) {
struct signal_struct *sig = task->signal; struct signal_struct *sig = task->signal;
struct tty_struct *tty = sig->tty;
if (sig->tty) {
if (tty) { tty_pgrp = sig->tty->pgrp;
/* tty_nr = new_encode_dev(tty_devnum(sig->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));
} }
num_threads = atomic_read(&sig->count); num_threads = atomic_read(&sig->count);
...@@ -395,7 +388,6 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) ...@@ -395,7 +388,6 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole)
unlock_task_sighand(task, &flags); unlock_task_sighand(task, &flags);
} }
rcu_read_unlock(); rcu_read_unlock();
mutex_unlock(&tty_mutex);
if (!whole || num_threads<2) if (!whole || num_threads<2)
wchan = get_wchan(task); wchan = get_wchan(task);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册