*BSD News Article 73727


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.eng.convex.com!newshost.convex.com!bcm.tmc.edu!pendragon!news.msfc.nasa.gov!newsfeed.internetmci.com!news.mathworks.com!uunet!inXS.uu.net!news.artisoft.com!usenet
From: Terry Lambert <terry@lambert.org>
Newsgroups: comp.os.linux.networking,comp.unix.bsd.netbsd.misc,comp.unix.bsd.freebsd.misc
Subject: Re: TCP latency
Date: Sun, 14 Jul 1996 23:11:46 -0700
Organization: Me
Lines: 57
Message-ID: <31E9E122.190E8C64@lambert.org>
References: <4paedl$4bm@engnews2.eng.sun.com> <m24tnf9f69.fsf@frob.mlm.extern.lrz-muenchen.de> <4sbhrq$msh@enomem.lkg.dec.com> <31E995B6.573A3461@lambert.org> <4schqh$ssa@panix2.panix.com>
NNTP-Posting-Host: hecate.artisoft.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.01 (X11; I; Linux 1.1.76 i486)
Xref: euryale.cc.adfa.oz.au comp.os.linux.networking:45223 comp.unix.bsd.netbsd.misc:4047 comp.unix.bsd.freebsd.misc:23583

Thor Lancelot Simon wrote:
] >You would map the buffer into both the source and target
] >applications address spaces, and avoid the user->kernel->user
] >copies.
] 
] If you want to do that, don't you want to just change
] copyin/copyout to copy any unaligned portion at either end,
] and then map instead of copying the middle?  This wins for
] everything, without requiring a change in user-level semantics.
] 
] I was lucky enough to get to discuss this with Kirk McKusick
] at one point a few months ago.  He indicated that at least one
] version of Mach had done exactly that on the VAX, and that it
] turned out to be a win iff you wanted to move more than about
] 8K.  Of course, that number is so utterly hardware dependent...

You could change the the copyin/copyout; however, the benefit
to using mapping of kernel buffer is page alignment.

If I have a page aligned buffer that I wanted to send out the
wire (to go back to networking) I could:

                         ,- page boundry
                        v
                         [ buffer ]   <- user mapping
                [ page ] [ buffer ]   <- kernel mapping
               ^   ^
               |   `- write header cruft here
           copy network
           data to card starting at buffer offest minu header
           size (up to 4k).

It should be obvious that using this method, you chould turn an
NFS read request around in the kernel

Using DMA devices for disk and nework I/O, and having a unified
VM cache, the cost will be:

	1 DMA from disk to memory (you have to do this anyway)
	1 page offset mapping
        1 copy for header data
        1 DMA from memory to network (you have to do this anyway)

This should save you several copies over FreeBSD, at least one
more copy over Linux (which has user space NFS), and additional
per header copies over ordinary Streams.

PS: Implemented this in prototype in Mentat Streams on VMS in
    1992 or so for the Pathworks for VMS (NetWare) server.



                                        Terry Lambert
                                        terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.