Date: Wed, 30 Jul 2003 23:32:49 +0200 From: Pierre Beyssac <pb@fasterix.frmug.org> To: freebsd-current@freebsd.org Cc: silby@freebsd.org Subject: bug in big pipe code causing performance problems Message-ID: <20030730213249.GA900@fasterix.frmug.org>
next in thread | raw e-mail | index | archive | help
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 -0000 1.140
+++ sys_pipe.c 30 Jul 2003 21:19:41 -0000
@@ -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 pb@fasterix.frmug.org pb@fasterix.freenix.org
Free domains: http://www.eu.org/ or mail dns-manager@EU.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030730213249.GA900>
