Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Aug 2008 20:50:38 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 148550 for review
Message-ID:  <200808262050.m7QKoc2M020600@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=148550

Change 148550 by ed@ed_dull on 2008/08/26 20:50:15

	Small optimisations:
	
	- There is no need to check iblen before the first iteration,
	  because we wouldn't have uiomove()'d if we didn't have any
	  data to read.
	
	- Don't check iblen twice when taking the fast write path.

Affected files ...

.. //depot/projects/mpsafetty/sys/kern/tty_pts.c#15 edit

Differences ...

==== //depot/projects/mpsafetty/sys/kern/tty_pts.c#15 (text+ko) ====

@@ -178,7 +178,8 @@
 		 * When possible, avoid the slow path. rint_bypass()
 		 * copies all input to the input queue at once.
 		 */
-		while (iblen > 0) {
+		MPASS(iblen > 0);
+		do {
 			if (ttydisc_can_bypass(tp)) {
 				/* Store data at once. */
 				rintlen = ttydisc_rint_bypass(tp,
@@ -188,7 +189,7 @@
 
 				if (iblen == 0) {
 					/* All data written. */
-					continue;
+					break;
 				}
 			} else {
 				error = ttydisc_rint(tp, *ibstart, 0);
@@ -217,7 +218,7 @@
 			error = cv_wait_sig(&psc->pts_inwait, tp->t_mtx);
 			if (error != 0)
 				goto done;
-		}
+		} while (iblen > 0);
 
 		if (uio->uio_resid == 0)
 			break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808262050.m7QKoc2M020600>