From owner-freebsd-current Wed Apr 1 04:15:45 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA15392 for freebsd-current-outgoing; Wed, 1 Apr 1998 04:15:45 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from mhub3.tc.umn.edu (0@mhub3.tc.umn.edu [128.101.131.53]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id EAA15387 for ; Wed, 1 Apr 1998 04:15:42 -0800 (PST) (envelope-from adkin003@tc.umn.edu) Received: from gold.tc.umn.edu by mhub3.tc.umn.edu; Wed, 1 Apr 98 06:15:36 -0600 Received: from pub-27-c-216.dialup.umn.edu by gold.tc.umn.edu; Wed, 1 Apr 98 06:15:31 -0600 Date: Wed, 1 Apr 1998 06:15:28 -0600 (CST) From: dave adkins X-Sender: adkin003@samthedog Reply-To: dave adkins To: freebsd-current@FreeBSD.ORG Subject: Re: -current X11 slowdown confirmation In-Reply-To: <199804011108.GAA09829@hda.hda.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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