svn commit: r194769 - head/sys/kern
Ed Schouten
ed at FreeBSD.org
Tue Jun 23 21:33:27 UTC 2009
Author: ed
Date: Tue Jun 23 21:33:26 2009
New Revision: 194769
URL: http://svn.freebsd.org/changeset/base/194769
Log:
Use dcdwait to block threads to serialize writes.
I suspect the usage of bgwait causes a lot of spurious wakeups when
threads are blocked in the background, because they will be woken up
each time a write() call is performed.
Also wakeup dcdwait when the TTY is abandoned.
Modified:
head/sys/kern/tty.c
Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c Tue Jun 23 21:24:21 2009 (r194768)
+++ head/sys/kern/tty.c Tue Jun 23 21:33:26 2009 (r194769)
@@ -335,6 +335,7 @@ ttydev_close(struct cdev *dev, int fflag
tp->t_revokecnt++;
tty_wakeup(tp, FREAD|FWRITE);
cv_broadcast(&tp->t_bgwait);
+ cv_broadcast(&tp->t_dcdwait);
ttydev_leave(tp);
@@ -455,7 +456,7 @@ ttydev_write(struct cdev *dev, struct ui
} else {
/* Serialize write() calls. */
while (tp->t_flags & TF_BUSY_OUT) {
- error = tty_wait(tp, &tp->t_bgwait);
+ error = tty_wait(tp, &tp->t_dcdwait);
if (error)
goto done;
}
@@ -463,7 +464,7 @@ ttydev_write(struct cdev *dev, struct ui
tp->t_flags |= TF_BUSY_OUT;
error = ttydisc_write(tp, uio, ioflag);
tp->t_flags &= ~TF_BUSY_OUT;
- cv_broadcast(&tp->t_bgwait);
+ cv_broadcast(&tp->t_dcdwait);
}
done: tty_unlock(tp);
More information about the svn-src-head
mailing list