mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kuznet@ms2.inr.ac.ru
To: chris@scary.beasts.org (Chris Evans)
Cc: linux-kernel@vger.kernel.org, davem@redhat.com
Subject: Re: SO_SNDTIMEO: 2.4 kernel bugs
Date: Mon, 19 Feb 2001 21:03:32 +0300 (MSK)	[thread overview]
Message-ID: <200102191803.VAA12658@ms2.inr.ac.ru> (raw)
In-Reply-To: <Pine.LNX.4.30.0102190025270.19003-100000@ferret.lmh.ox.ac.uk> from "Chris Evans" at Feb 19, 1 01:04:28 am

Hello!

> You are right - our sendfile() implementation is broken. I have fixed it

Thank you!


> Investigation shows that the Linux network layer is behaving oddly. It
> seems that we are writing 4096 bytes to a socket. This proceeds in 4096
> byte chunks until the send buffer on the socket is full, and a 4096 byte
> write blocks. This blocking write is eventually interrupted by the
> timeout, and the write call returns.. wait for it.. 4096! This suggests
> there was socket space after all, and the call should not have blocked.

Wakeup does not happen until _enough_ (1/3 of snbuf) of space in sndbuf
is released, otherwise you will overschedule. So, as soon as
write() goes to sleep, it will sleep waiting until 1/3 is released.

If it is interrupted, it use all the released space immediately before exit.
Again, to make more for in this context. This can be even wrong and, probably,
we should return instantly with -EAGAIN/-EINTR/partial count, but it is most
likely suboptimal (though I have already changed this to instant return).
But this does not look essential from caller's viewpoint, except for
sendfile() of course. 8)

Alexey

  parent reply	other threads:[~2001-02-19 18:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-17  1:35 Chris Evans
2001-02-17 20:29 ` kuznet
2001-02-17 21:56   ` Chris Evans
2001-02-17 22:46   ` Chris Evans
2001-02-18 17:24     ` kuznet
2001-02-18 19:25       ` Chris Evans
2001-02-18 19:33         ` kuznet
2001-02-18 19:37           ` Chris Evans
2001-02-18 19:48             ` kuznet
2001-02-19  1:04       ` Chris Evans
2001-02-19  1:43         ` sendfile() breakage was " Chris Evans
2001-02-19 18:03         ` kuznet [this message]
2001-02-19 21:56           ` Chris Evans
2001-02-20 15:09             ` David Woodhouse
2001-02-18  1:50   ` Chris Evans

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=200102191803.VAA12658@ms2.inr.ac.ru \
    --to=kuznet@ms2.inr.ac.ru \
    --cc=chris@scary.beasts.org \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®