tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sleeping instead of ENOBUFS on write to socket?



On Fri, May 27, 2011 at 01:08:05PM +0000, Emmanuel Dreyfus wrote:
> 
> The questions:
> - did I miss a way to sleep on write when kernel is out of buffer memory?
> - if this is impossible, what about adding a socket option for that?
> - would it make sense to have such an option be the default for 
> SOCK_STREAM and SOCK_SEQPACKET? 

Do yiu mean the kernel is out of memory? or just the socket?

It ought to depend on whether the socket/fd is in blocking or non-blocking mode.

I'm not sure what happens for blocking datagram sockets.
IMHO they shouldn't be discarded by any part of the network stack just because
the attempted transmit rate exceeds the network bandwidth.
However I suspect that some of the ethernet mac drivers discard when their 
transmit
queue exceeds some level (instead of somehow applying back pressure to the
message originators).

Since back pressure through mux is hard, it is better to limit the number of
buffers each source can supply - ensuring the ownership is kept until the
data is really freed.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index