diff options
author | Ivo Sieben <meltedpianoman@gmail.com> | 2012-05-03 08:37:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-10 14:24:03 -0400 |
commit | 1541f845d123a48fbca3cee32b2963b3fb3da83a (patch) | |
tree | ace9a1f9278ea84101359d189894c71548193136 /drivers/tty/tty_ldisc.c | |
parent | 3e62c413fb0c75c8cfaf086d00a9ecc6b55009d6 (diff) |
tty: move global ldisc idle waitqueue to the individual ldisc
The global wait_queue that is used for line discipline idle handling is
moved to a separate wait_queue for each line instance. This prevents
unnecessary blocking on one line, because of idle handling on another
line.
Signed-off-by: Ivo Sieben <meltedpianoman@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_ldisc.c')
-rw-r--r-- | drivers/tty/tty_ldisc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index fa65cde395a..173a9000a6c 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | static DEFINE_SPINLOCK(tty_ldisc_lock); | 29 | static DEFINE_SPINLOCK(tty_ldisc_lock); |
30 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); | 30 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); |
31 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_idle); | ||
32 | /* Line disc dispatch table */ | 31 | /* Line disc dispatch table */ |
33 | static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS]; | 32 | static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS]; |
34 | 33 | ||
@@ -65,7 +64,7 @@ static void put_ldisc(struct tty_ldisc *ld) | |||
65 | return; | 64 | return; |
66 | } | 65 | } |
67 | local_irq_restore(flags); | 66 | local_irq_restore(flags); |
68 | wake_up(&tty_ldisc_idle); | 67 | wake_up(&ld->wq_idle); |
69 | } | 68 | } |
70 | 69 | ||
71 | /** | 70 | /** |
@@ -200,6 +199,8 @@ static struct tty_ldisc *tty_ldisc_get(int disc) | |||
200 | 199 | ||
201 | ld->ops = ldops; | 200 | ld->ops = ldops; |
202 | atomic_set(&ld->users, 1); | 201 | atomic_set(&ld->users, 1); |
202 | init_waitqueue_head(&ld->wq_idle); | ||
203 | |||
203 | return ld; | 204 | return ld; |
204 | } | 205 | } |
205 | 206 | ||
@@ -538,7 +539,7 @@ static void tty_ldisc_flush_works(struct tty_struct *tty) | |||
538 | static int tty_ldisc_wait_idle(struct tty_struct *tty, long timeout) | 539 | static int tty_ldisc_wait_idle(struct tty_struct *tty, long timeout) |
539 | { | 540 | { |
540 | long ret; | 541 | long ret; |
541 | ret = wait_event_timeout(tty_ldisc_idle, | 542 | ret = wait_event_timeout(tty->ldisc->wq_idle, |
542 | atomic_read(&tty->ldisc->users) == 1, timeout); | 543 | atomic_read(&tty->ldisc->users) == 1, timeout); |
543 | return ret > 0 ? 0 : -EBUSY; | 544 | return ret > 0 ? 0 : -EBUSY; |
544 | } | 545 | } |