On Mon, Dec 14, 2009 at 06:21:55AM +0000, David Holland wrote: > On Sun, Dec 13, 2009 at 08:02:24PM +0000, David Laight wrote: > > Log Message: > > Another, better, fix for PR/26567. > > Only sleep once within each pipe_read/pipe_write call. > > If there is no data/space available after we wakeup return ERESTART so > > then the 'fd' number is validated again. > > A simple broadcast of the cvs is then enough to evict the correct threads > > when close() is called from an active thread. > > Isn't this going to cause a thundering herd problem if there are a lot > of readers competing for the input? The first one will wake up and > consume the available data, and then the rest will take a trip all the > way to userspace and back. > > This may or may not be a practical problem for pipes but I'd expect > the same approach to suck pretty hard for e.g. accept() on sockets. :(
Sockets have other problems - like not always having a syscall interface for ERESTART to loop on. I was actually thinking of making the fo_abort() call set a flag on the socket and only do the ERESTART if that flag is set. Then you only take the hit on 'file's associated with 'fd' that get closed with a read/write in progress. I also need to rename fo_abort() to fo_restart(). David -- David Laight: da...@l8s.co.uk