Re: bug in big pipe code causing performance problems
On Wed, 30 Jul 2003, Pierre Beyssac wrote: > On Wed, Jul 30, 2003 at 11:32:49PM +0200, Pierre Beyssac wrote: > > - if (space > 0 && (wpipe->pipe_buffer.cnt < PIPE_SIZE)) { > > + if (space > 0 > > + && wpipe->pipe_buffer.cnt < wpipe->pipe_buffer.size) { > > PS : not-so-obvious after all since the above is equivalent to > "(space > 0)" by itself, so I won't commit the above as is, and the > real fix might be something more complicated... > -- > Pierre Beyssac[EMAIL PROTECTED] [EMAIL PROTECTED] > Free domains: http://www.eu.org/ or mail [EMAIL PROTECTED] Good timing. :) I was just writing a reply which stated that (space > 0) would be sufficient. However, as you point out, there might be something subtle lurking around. I'll do some doublechecking tonight and get back to you. Mike "Silby" Silbersack ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: bug in big pipe code causing performance problems
On Wed, Jul 30, 2003 at 11:32:49PM +0200, Pierre Beyssac wrote: > - if (space > 0 && (wpipe->pipe_buffer.cnt < PIPE_SIZE)) { > + if (space > 0 > + && wpipe->pipe_buffer.cnt < wpipe->pipe_buffer.size) { PS : not-so-obvious after all since the above is equivalent to "(space > 0)" by itself, so I won't commit the above as is, and the real fix might be something more complicated... -- Pierre Beyssac [EMAIL PROTECTED] [EMAIL PROTECTED] Free domains: http://www.eu.org/ or mail [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "[EMAIL PROTECTED]"
bug in big pipe code causing performance problems
Hello, If no one objects to it, I'd like to commit the following ASAP. It fixes an obvious bug in the big pipe code, a discrepancy between how free space is calculated in write vs poll. The bug affects stable as well. The bug's implications are less obvious: it make write(2) on a non-blocking pipe return EAGAIN when poll(2) & select(2) return the descriptor as ready for write. This in turns causes the libc_r code to busy-wait on pipes, causing a major performance hog. As an example the patch boosts the multimedia/transcode port (a big pipes & threads user) by a factor of 2-3. Index: sys_pipe.c === RCS file: /home/ncvs/src/sys/kern/sys_pipe.c,v retrieving revision 1.140 diff -u -r1.140 sys_pipe.c --- sys_pipe.c 30 Jul 2003 18:55:04 - 1.140 +++ sys_pipe.c 30 Jul 2003 21:19:41 - @@ -1041,7 +1041,8 @@ if ((space < uio->uio_resid) && (orig_resid <= PIPE_BUF)) space = 0; - if (space > 0 && (wpipe->pipe_buffer.cnt < PIPE_SIZE)) { + if (space > 0 + && wpipe->pipe_buffer.cnt < wpipe->pipe_buffer.size) { if ((error = pipelock(wpipe,1)) == 0) { int size; /* Transfer size */ int segsize;/* first segment to transfer */ -- Pierre Beyssac [EMAIL PROTECTED] [EMAIL PROTECTED] Free domains: http://www.eu.org/ or mail [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "[EMAIL PROTECTED]"