Re: zero-copy TCP

From: Linus Torvalds (torvalds@transmeta.com)
Date: Mon Sep 04 2000 - 11:41:25 EST


On Mon, 4 Sep 2000, Jamie Lokier wrote:

> Linus Torvalds wrote:
>
> > Basically any copy <= 4 cache lines is "free" compared to trying to be
> > clever.
>
> We're obviously interested in larger packets than 128 bytes.

"obviously"?

Take a look at some common traffic. Yes, even in servers.

Small packets are not unlikely.

And even if you add extra code to _not_ do it for small packets, what
you're basically doing is slowing down the path - and increasing your
icache footprint etc quite noticeably, because suddenly you have two
mostly independent paths.

And the bugs get interesting too.

Also, you ignored the fact that the 128 can be 256 or 512. AND you ignored
the fact that I was being very generous indeed to the page table walking
case. So the 128 can end up being quite close to the page size. Or more.

> That's why the data is DMA'd to the card immediately, and that _card_
> retains the data at least for the short term. Long term if it's still
> retained and the card runs out of memory, the card DMAs old buffers back
> to a kernel skbuff. This is one way to avoid TLBs.

Yeah.

And such a card doesn't actually exist. At least not in copious numbers.

You need megabytes of memory to hold stuff like that for a busy server. A
few hundred connections with a few kB of queued-up, unacked data.

Face it, it's not realistic. Sure, such cards exist. How many people have
ever _seen_ one?

> Some people who claim zero-copy is great have done actual measurements
> and it does look good for reasonable size packets. Even though the raw
> performance doesn't look that much better, the CPU utilisation does so
> you can actually _calculate_ a bit more with your data.
>
> However, I've not seen any evidence that it's a good idea with the
> standard unix APIs. I suspect everyone will agree on that :-)

Blame the API's.

Face it, complexity almost _never_ pays off.

                Linus

-
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/



This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:18 EST