Date: Mon, 19 Oct 2009 07:17:37 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r198223 - in head/sys: kern sys Message-ID: <200910190717.n9J7HbpP094533@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Mon Oct 19 07:17:37 2009 New Revision: 198223 URL: http://svn.freebsd.org/changeset/base/198223 Log: Properly set the low watermarks when reducing the baud rate. Now that buffers are deallocated lazily, we should not use tty*q_getsize() to obtain the buffer size to calculate the low watermarks. Doing this may cause the watermark to be placed outside the typical buffer size. This caused some regressions after my previous commit to the TTY code, which allows pseudo-devices to resize the buffers as well. Reported by: yongari, dougb MFC after: 1 week Modified: head/sys/kern/tty.c head/sys/sys/ttyqueue.h Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sun Oct 18 23:38:59 2009 (r198222) +++ head/sys/kern/tty.c Mon Oct 19 07:17:37 2009 (r198223) @@ -109,14 +109,14 @@ tty_watermarks(struct tty *tp) ttyinq_setsize(&tp->t_inq, tp, bs); /* Set low watermark at 10% (when 90% is available). */ - tp->t_inlow = (ttyinq_getsize(&tp->t_inq) * 9) / 10; + tp->t_inlow = (ttyinq_getallocatedsize(&tp->t_inq) * 9) / 10; /* Provide an ouput buffer for 0.2 seconds of data. */ bs = MIN(tp->t_termios.c_ospeed / 5, TTYBUF_MAX); ttyoutq_setsize(&tp->t_outq, tp, bs); /* Set low watermark at 10% (when 90% is available). */ - tp->t_outlow = (ttyoutq_getsize(&tp->t_outq) * 9) / 10; + tp->t_outlow = (ttyoutq_getallocatedsize(&tp->t_outq) * 9) / 10; } static int Modified: head/sys/sys/ttyqueue.h ============================================================================== --- head/sys/sys/ttyqueue.h Sun Oct 18 23:38:59 2009 (r198222) +++ head/sys/sys/ttyqueue.h Mon Oct 19 07:17:37 2009 (r198223) @@ -93,6 +93,13 @@ ttyinq_getsize(struct ttyinq *ti) } static __inline size_t +ttyinq_getallocatedsize(struct ttyinq *ti) +{ + + return (ti->ti_quota * TTYINQ_DATASIZE); +} + +static __inline size_t ttyinq_bytesleft(struct ttyinq *ti) { size_t len; @@ -143,6 +150,13 @@ ttyoutq_getsize(struct ttyoutq *to) } static __inline size_t +ttyoutq_getallocatedsize(struct ttyoutq *to) +{ + + return (to->to_quota * TTYOUTQ_DATASIZE); +} + +static __inline size_t ttyoutq_bytesleft(struct ttyoutq *to) { size_t len;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910190717.n9J7HbpP094533>