mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kuznet@ms2.inr.ac.ru
To: ntd1@cs.waikato.ac.NZ (Nicholas Daley)
Cc: linux-kernel@vger.kernel.org
Subject: Re: PROBLEM: small socket send/receive buffers on TCP stream result in data not being transferred
Date: Thu, 1 Feb 2001 21:53:14 +0300 (MSK)	[thread overview]
Message-ID: <200102011853.VAA21071@ms2.inr.ac.ru> (raw)
In-Reply-To: <3A792872.4030306@cs.waikato.ac.nz> from "Nicholas Daley" at Feb 1, 1 12:15:01 pm

Hello!

> 1. small socket send/receive buffers result in data not being transferred

I know why your test does not work in 2.4 (sort of bug, fix is appended).

But I have no idea, why it does not work with 2.2. Please, make
tcpdump in this case.


> and SO_RCVBUF (see small attached programs), I found that given small
> enough buffers, data would stop being sent, although more was available.

No doubts. If you think that tcp must work like gun no matter
what silly things application makes, you are mistaken.
TCP works like gun when application does not try to interlope. 8)

You have made two capital mistakes:

1. RCVBUF/SNDBUF are not arbibrary numbers. Of course, kernel tries
   to adjust them to something reasonable, when user asks something
   wicked (like your case), but it cannot do this in all the cases.
2. Playing with buffer sizes after connection is established
   is very bad idea, tcp is defenceless in this case.

> This behaviour may depend on the speed of the system, on mine I can

Surely, it is not.


> usually get it to happen with buffer sizes around 100

Advice: do not play with these sockopts. Kernel does this better,
than any application.

Application may set them, when it wants to set large values.
Values, selected by kernel by default, are minimal ones in fact.

Alexey


--- ../vger3-010130/linux/include/net/tcp.h	Wed Dec 13 22:37:49 2000
+++ linux/include/net/tcp.h	Thu Feb  1 21:08:45 2001
@@ -1304,7 +1305,8 @@
 	struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
 
 	if (tp->ucopy.task) {
-		if ((tp->ucopy.memory += skb->truesize) <= (sk->rcvbuf<<1)) {
+		if (tp->ucopy.memory < (sk->rcvbuf<<1)) {
+			tp->ucopy.memory += skb->truesize;
 			__skb_queue_tail(&tp->ucopy.prequeue, skb);
 			if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
 				wake_up_interruptible(sk->sleep);
@@ -1313,7 +1315,6 @@
 			}
 		} else {
 			NET_INC_STATS_BH(TCPPrequeueDropped);
-			tp->ucopy.memory -= skb->truesize;
 			__kfree_skb(skb);
 		}
 		return 1;
-
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-02-01 18:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-01  9:12 Nicholas Daley
2001-02-01 18:53 ` kuznet [this message]

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=200102011853.VAA21071@ms2.inr.ac.ru \
    --to=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntd1@cs.waikato.ac.NZ \
    /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®