mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Samuelson <peter@cadcamlab.org>
To: Jonathan Earle <jearle@nortelnetworks.com>
Cc: "'Mathieu Chouquet-Stringer'" <mchouque@e-steel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [UPDATE] Zerocopy patches, against 2.4.1-pre10
Date: Wed, 24 Jan 2001 17:33:12 -0600	[thread overview]
Message-ID: <20010124173312.A6941@cadcamlab.org> (raw)
In-Reply-To: <28560036253BD41191A10000F8BCBD116BDCD7@zcard00g.ca.nortel.com>
In-Reply-To: <28560036253BD41191A10000F8BCBD116BDCD7@zcard00g.ca.nortel.com>; from jearle@nortelnetworks.com on Wed, Jan 24, 2001 at 04:52:19PM -0500


[Jonathan Earle]
> Hmm.. so things like routing should be faster then?

Other network traffic too.  Say you have an FTP server running and it
wants to send a file out to a client.  The old way was for it to read()
the file into memory and then write() it to the network socket.  To
avoid having to copy all that data into the userspace buffer during
read(), you can use mmap() instead.  In Linux 2.1.1xx we gained a new
syscall sendfile() which works like mmap()+write(), except faster since
the necessary kernel memory management is a lot simpler.  Using either
sendfile() or mmap(), the userspace program (ftpd) doesn't have to
touch the memory involved, just send it on to the socket.  That was the
first optimization relevant here, and it's been around awhile now.

Now with mmap()+write() or sendfile(), the kernel reads the data off
the disk using the page cache, then the network stack copies it to
other buffers, doing the TCP checksum in the process, and eventually
the Ethernet card does a DMA transfer of some sort and sends it out the
wire.  Notice that the CPU has to copy the data from the disk DMA
buffer to the network card DMA buffer, checksumming it somewhere along
the way.  Depending on circumstance, of course, there may be other
copying involved as well.

With zerocopy, when you issue sendfile(), the kernel does the network
DMA straight from the page cache, avoiding that extra copy.  In the
case where the network card is capable of doing the TCP checksum in
hardware (as a lot of newer cards can), the kernel doesn't even have to
look at the data between the disk DMA and the network DMA.  This can
save memory accesses and CPU data cache pollution.  The only way to get
a more direct route would be to do the DMA from disk controller to
network card without touching main memory at all, but this can have a
lot of complications and is probably not worth it in general -- see a
recent discussion on this list.

> What caveats should one watch for (ie: what functionalities will not
> work as before - if any)?

Ideally as a regular user you don't notice anything except things go
perhaps a bit faster.  I have no idea whether Davem's patch achieves
this yet..

Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2001-01-24 23:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-24 21:52 Jonathan Earle
2001-01-24 23:33 ` Peter Samuelson [this message]
     [not found] <200101242123.NAA00986@pizda.ninka.net>
2001-01-25  1:40 ` Andrew Morton
2001-01-25 19:29   ` kuznet
2001-01-25 20:28     ` Ion Badulescu
2001-01-25 20:36       ` kuznet
2001-01-25 20:43     ` David S. Miller
2001-01-25 21:11       ` Ion Badulescu
2001-01-26 19:43         ` kuznet
2001-01-29 22:02         ` David S. Miller
2001-01-25 21:14       ` David S. Miller
2001-01-25 21:29         ` Steve Whitehouse
2001-01-31 16:04           ` Alan Cox
2001-01-25 21:38         ` David S. Miller
2001-01-26  6:06         ` Ion Badulescu
2001-01-26 13:13         ` David S. Miller
2001-01-26 20:43           ` Ion Badulescu
2001-01-27  0:55             ` Ion Badulescu
2001-01-27 18:39               ` kuznet
2001-01-27 21:18                 ` Ion Badulescu
2001-01-30  6:02                 ` David S. Miller
2001-01-26  1:27     ` Andrew Morton
2001-01-25  9:29 ` David S. Miller
  -- strict thread matches above, loose matches on Subject: below --
2001-01-24 21:34 Jonathan Earle
2001-01-24 21:45 ` Mathieu Chouquet-Stringer
2001-01-31 22:42   ` Rogerio Brito

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010124173312.A6941@cadcamlab.org \
    --to=peter@cadcamlab.org \
    --cc=jearle@nortelnetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchouque@e-steel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®