Date: Fri, 3 Apr 1998 22:48:58 +0400 From: =?koi8-r?B?4c7E0sXKIP7F0s7P1w==?= <ache@nagual.pp.ru> To: Poul-Henning Kamp <phk@critter.freebsd.dk>, "Alok K. Dhir" <adhir@worldbank.org>, current@FreeBSD.ORG, adkin003@tc.umn.edu Subject: Working patch *with* splhigh() (Was Re: More info RE: X slowdown in -current) Message-ID: <19980403224858.27971@nagual.pp.ru> In-Reply-To: <19980403222540.64574@nagual.pp.ru>; from ache@nagual.pp.ru on Fri, Apr 03, 1998 at 10:25:40PM %2B0400 References: <19980403214836.43861@nagual.pp.ru> <2814.891626804@critter.freebsd.dk> <19980403222540.64574@nagual.pp.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
Well, here is working patch *WITH* splhigh(), since no errors here,
it even can be commited until real solution found. So I take out my
splhigh() claims.
*** sys_generic.c.orig Thu Apr 2 11:22:17 1998
--- sys_generic.c Fri Apr 3 22:31:09 1998
***************
*** 538,545 ****
*/
fd_mask s_selbits[howmany(2048, NFDBITS)];
fd_mask *ibits[3], *obits[3], *selbits, *sbp;
! struct timeval atv;
! int s, ncoll, error, timo, term;
u_int nbufbytes, ncpbytes, nfdbits;
if (uap->nd < 0)
--- 538,545 ----
*/
fd_mask s_selbits[howmany(2048, NFDBITS)];
fd_mask *ibits[3], *obits[3], *selbits, *sbp;
! struct timeval atv, ctv;
! int s, ncoll, error, timo;
u_int nbufbytes, ncpbytes, nfdbits;
if (uap->nd < 0)
***************
*** 600,620 ****
error = EINVAL;
goto done;
}
! term = ticks + tvtohz(&atv);
} else
! term = 0;
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 (term && term <= ticks) {
! splx(s);
goto done;
}
! timo = term ? term - ticks : 0;
if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) {
splx(s);
goto retry;
--- 600,623 ----
error = EINVAL;
goto done;
}
! getmicrotime(&ctv);
! timevaladd(&atv, &ctv);
! timo = hzto(&atv);
} else
! timo = 0;
retry:
ncoll = nselcoll;
p->p_flag |= P_SELECT;
error = selscan(p, ibits, obits, uap->nd);
if (error || p->p_retval[0])
goto done;
! 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;
}
! s = splhigh();
if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) {
splx(s);
goto retry;
***************
*** 701,708 ****
{
caddr_t bits;
char smallbits[32 * sizeof(struct pollfd)];
! struct timeval atv;
! int s, ncoll, error = 0, timo, term;
size_t ni;
if (SCARG(uap, nfds) > p->p_fd->fd_nfiles) {
--- 704,711 ----
{
caddr_t bits;
char smallbits[32 * sizeof(struct pollfd)];
! struct timeval atv, ctv;
! int s, ncoll, error = 0, timo;
size_t ni;
if (SCARG(uap, nfds) > p->p_fd->fd_nfiles) {
***************
*** 724,744 ****
error = EINVAL;
goto done;
}
! term = ticks + tvtohz(&atv);
} else
! term = 0;
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 (term && term <= ticks) {
! splx(s);
goto done;
! }
! timo = term ? term - ticks : 0;
if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) {
splx(s);
goto retry;
--- 727,747 ----
error = EINVAL;
goto done;
}
! getmicrotime(&ctv);
! timevaladd(&atv, &ctv);
! timo = hzto(&atv);
} else
! timo = 0;
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;
! getmicrotime(&ctv);
! if (timo && timercmp(&ctv, &atv, >=))
goto done;
! s = splhigh();
if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) {
splx(s);
goto retry;
--
Andrey A. Chernov
http://www.nagual.pp.ru/~ache/
MTH/SH/HE S-- W-- N+ PEC>+ D A a++ C G>+ QH+(++) 666+>++ Y
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980403224858.27971>
