Subject: Faster pipes, now with uvm_loan()
To: None <tech-kern@netbsd.org>
From: Jaromír <jdolecek@netbsd.org>
List: tech-kern
Date: 04/09/2001 21:08:37
Hi,
thanks to Chuck Cranor's help, patch to uvm_loan() and point towards
right direction, I got the version using uvm_loan() working. uvm_loan() is used
for "big enough" transfers. Performance improvement for lmbench/bw_pipe
on my PIII/600 was about 20%, on my 386DX ~30%:
old pipes new pipes new pipes with uvm_loan()
PIII 487 MB/sec 487 MB/sec 567 MB/sec
386DX 0.75 MB/sec 3.57 MB/sec 4.70 MB/sec
There is maybe still some room for improvement, but I don't expect
any big performance leap. The thing seems to work in multiuser
okay and md5 doesn't reveal any differences between real data
and data passed through pipe.
After looking at the black voodoo magic needed for FreeBSD VM
"direct write" version, I was really pleased how elegant and
easy the same thing was with UVM uvm_loan(). Once again, UVM
advanced design and sane implementation shines.
I've changed the code to allocate kva for buffer in sys_pipe(2)
and DTRT if attempt to allocate bigpipe fails, i.e. the code could not
be used for local DoS attach as the FreeBSD version could.
TODOs:
* KVA consumption limits - for uvm_loan(), the code currently unconditionally
tries to loan the whole writers buffer; the panic there is temporary,
needs to be replaced by something sane
* make other limits and bidirectionality settable via sysctl
* don't allocate kva for read end of pipe, unless using bidirectional pipes
* SMP support: the code is pathetic WRT SMP, needs substantial improvement
I've put the code to ftp at:
ftp://ftp.netbsd.org/pub/NetBSD/misc/jdolecek/
You need the archive newpipe-1.0.tgz; optionally, you can read README.newpipe
(the latter is included in the archive, too).
Note you'd also need patch to uvm_loan.c (written by Chuck Cranor).
It's on the above address too, file uvm_loan.patch. You also need
very up-to-date kernel, the new pipe code is already written for
new fileops interface.
Enjoy,
Jaromir
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.ics.muni.cz/~dolecek/
NetBSD - just plain best OS! -=<>=- Got spare MCA cards or docs? Hand me them!