mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Nivedita Singhvi <niv@us.ibm.com>
Cc: hurwitz@lanl.gov, linux-kernel@vger.kernel.org
Subject: Re: zero-copy networking & a performance drop
Date: 28 Jun 2002 04:59:36 +0200	[thread overview]
Message-ID: <p73n0tgm7l3.fsf@oldwotan.suse.de> (raw)
In-Reply-To: Nivedita Singhvi's message of "28 Jun 2002 00:35:31 +0200"


Nivedita Singhvi <niv@us.ibm.com> writes:
> 	
> there are possibly many different scenario's here, and
> I'm probably missing the most obvious causes...

There is one problem with the TCP csum-copy to user RX implementation. When the
fast path misses (process not scheduling in time for some reason) the 
remaining packet is taken care of by the delack timer. This adds considerable
latency to the ACK generation (worst case 1/50s), because the stack does not
generate send the ack earlier when 2*rcvmss data is received  and can be 
visible as latency to user space in protocols that send lots of small messages.

csum-copy-to-user makes only sense when the NIC doesn't support hardware
checksumming, otherwise it is better to just queue and do a normal copy
and avoid these latencies.

I'm using this patch (should apply to any 2.4.4+ and 2.5). It essentially
disables most of the RX user context TCP for NICs with hardware checksums
(except for the usual processing as part of socket lock). IMHO the user 
context code (prequeue etc.) is not too useful because of the latencies it 
adds and it would be best to drop it. Most NICs should have hardware 
checksumming these days and those that don't are likely slow enough (old 
Realtek) to not need any special hacks.

With that patch it also makes even more sense to go for a SSE optimized
copy-to-user to get more speed out of networking.

Regarding the RX slowdown: I think there was some slowdown in chatroom
when the zero-copy TX stack was introduced. chatroom is horrible 
benchmark in itself, but the stack work should not have slowed it down.
It's possible that it is fixed by this patch too; i haven't checked.

-Andi

diff -urN linux-2.4.18.tmp/net/ipv4/tcp_ipv4.c linux-2.4.18.SuSE/net/ipv4/tcp_ipv4.c
--- linux-2.4.18.tmp/net/ipv4/tcp_ipv4.c	Mon Apr 15 14:43:40 2002
+++ linux-2.4.18.SuSE/net/ipv4/tcp_ipv4.c	Mon Apr 15 16:19:52 2002
@@ -1767,7 +1775,7 @@
 	bh_lock_sock(sk);
 	ret = 0;
 	if (!sk->lock.users) {
-		if (!tcp_prequeue(sk, skb))
+		if (skb->ip_summed != CHECKSUM_NONE || !tcp_prequeue(sk, skb))
 			ret = tcp_v4_do_rcv(sk, skb);
 	} else
 		sk_add_backlog(sk, skb);


       reply	other threads:[~2002-06-28  2:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.44.0206271545220.17078-100000@alvie-mail.lanl.gov.suse.lists.linux.kernel>
     [not found] ` <Pine.LNX.4.33.0206271513320.13651-100000@w-nivedita2.des.beaverton.ibm.com.suse.lists.linux.kernel>
2002-06-28  2:59   ` Andi Kleen [this message]
2002-06-28 15:04     ` Nivedita Singhvi
2002-06-29 17:04 Nivedita Singhvi
  -- strict thread matches above, loose matches on Subject: below --
2002-06-28  3:01 Hurwitz Justin W.
2002-06-27 19:53 Nivedita Singhvi
2002-06-27 21:50 ` Hurwitz Justin W.
2002-06-27 22:33   ` Nivedita Singhvi
2002-06-28  9:33     ` Ingo Oeser
2002-06-28 16:43       ` Hurwitz Justin W.
2002-06-27 18:16 Hurwitz Justin W.
2002-06-27 21:08 ` Bernd Eckenfels

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=p73n0tgm7l3.fsf@oldwotan.suse.de \
    --to=ak@suse.de \
    --cc=hurwitz@lanl.gov \
    --cc=linux-kernel@vger.kernel.org \
    --cc=niv@us.ibm.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®