Date: Wed, 1 Apr 1998 06:15:28 -0600 (CST) From: dave adkins <adkin003@tc.umn.edu> To: freebsd-current@FreeBSD.ORG Subject: Re: -current X11 slowdown confirmation Message-ID: <Pine.NEB.3.96.980401055304.2664B-100000@samthedog> In-Reply-To: <199804011108.GAA09829@hda.hda.com>
index | next in thread | previous in thread | raw e-mail
hi,
i noticed that the slowdown in netscape would change with the amount of
cursor movement/keyboard input in the netscape window. I took a look at
select() and poll in sys_generic.c. Going back to sys_generic.c v1.33 and
replacing the use of time with getmicrotime(), the problem in netscape
seemed to go away. It looks like select() and poll() in sys_generic.c
v1.34 don't timeout correctly so netscape just waits at the
select()/poll() in its work loop until an event occurs.
----------------------------------------------------------------------
--- sys_generic.c.1.34 Wed Apr 1 05:43:52 1998
+++ sys_generic.c Wed Apr 1 05:44:05 1998
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)sys_generic.c 8.5 (Berkeley) 1/21/94
- * $Id: sys_generic.c,v 1.34 1998/03/30 09:50:29 phk Exp $
+ * $Id: sys_generic.c,v 1.33 1997/11/23 10:30:50 bde Exp $
*/
#include "opt_ktrace.h"
@@ -538,8 +538,8 @@
*/
fd_mask s_selbits[howmany(2048, NFDBITS)];
fd_mask *ibits[3], *obits[3], *selbits, *sbp;
- struct timeval atv;
- int s, ncoll, error, timo, term;
+ struct timeval atv,ctv;
+ int s, ncoll, error, timo;
u_int nbufbytes, ncpbytes, nfdbits;
if (uap->nd < 0)
@@ -600,29 +600,28 @@
error = EINVAL;
goto done;
}
- timo = tvtohz(&atv);
+ getmicrotime(&ctv);
+ timevaladd(&atv, &ctv);
+ timo = hzto(&atv);
} else
timo = 0;
- if (timo)
- term = timo + ticks;
retry:
ncoll = nselcoll;
p->p_flag |= P_SELECT;
error = selscan(p, ibits, obits, uap->nd);
if (error || p->p_retval[0])
goto done;
- s = splhigh();
- if (timo && term <= ticks) {
- splx(s);
+ getmicrotime(&ctv);
+ /* this should be timercmp(&time, &atv, >=) */
+ if (uap->tv && (ctv.tv_sec > atv.tv_sec ||
+ (ctv.tv_sec == atv.tv_sec && ctv.tv_usec >= atv.tv_usec))) {
goto done;
}
if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) {
- splx(s);
goto retry;
}
p->p_flag &= ~P_SELECT;
error = tsleep((caddr_t)&selwait, PSOCK | PCATCH, "select", timo);
- splx(s);
if (error == 0)
goto retry;
done:
@@ -702,8 +701,8 @@
{
caddr_t bits;
char smallbits[32 * sizeof(struct pollfd)];
- struct timeval atv;
- int s, ncoll, error = 0, timo, term;
+ struct timeval atv,ctv;
+ int s, ncoll, error = 0, timo;
size_t ni;
if (SCARG(uap, nfds) > p->p_fd->fd_nfiles) {
@@ -725,29 +724,26 @@
error = EINVAL;
goto done;
}
- timo = tvtohz(&atv);
+ getmicrotime(&ctv);
+ timevaladd(&atv, &ctv);
+ timo = hzto(&atv);
} else
timo = 0;
- if (timo)
- term = timo + ticks;
retry:
ncoll = nselcoll;
p->p_flag |= P_SELECT;
error = pollscan(p, (struct pollfd *)bits, SCARG(uap, nfds));
if (error || p->p_retval[0])
goto done;
- s = splhigh();
- if (timo && term <= ticks) {
- splx(s);
+ getmicrotime(&ctv);
+ if (timo && timercmp(&ctv, &atv, >=)) {
goto done;
}
if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) {
- splx(s);
goto retry;
}
p->p_flag &= ~P_SELECT;
error = tsleep((caddr_t)&selwait, PSOCK | PCATCH, "poll", timo);
- splx(s);
if (error == 0)
goto retry;
done:
----------------------------------------------------------------------------
dave adkins
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96.980401055304.2664B-100000>
