userland access to devices is moving!
Poul-Henning Kamp
phk at phk.freebsd.dk
Wed Jun 18 08:35:23 PDT 2003
I sat down and hacked up a simple prototype to test the concept I
have been rambling about for some years: Going directly from
filedescriptor to device driver thus bypassing the vnode, devfs and
specfs layer.
I implemented this for /dev/null and /dev/zero, and ran the simple
benchmark "dd if=/dev/zero of=/dev/null count=1000000"
Before:
N 3 Average: 44.900752667 Stddev: 0.049906338
After:
N 3 Average: 18.460190333 Stddev: 0.074019507
That is 26.4 microseconds saved for each read(2)+write(2) operation,
or 41% improvement on my Athlon 700MHz machine.
A bit more locking will probably be needed, so this will erode some
of this number, but there will be something left I'm sure :-)
The largest impact of this is that VOP_OPEN(), vn_open() and
vn_open_cred() grows an argument (the fdesc index) which existing
callers need to pass a -1, the rest is relatively local hacking in
devfs and some adjustments in the descriptor code.
I have overall found that the implementation of this is not as hard
as I imagined, and if I doubted it before, I am now certain that
this is the right way to go.
I should have tried this long time ago...
patch at:
http://phk.freebsd.dk/patch/fdesc.patch
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the freebsd-arch
mailing list