Re: Honoring SO_RCVLOWAT in proto_ops.poll methods
From: swivel
Date: Mon Oct 13 2008 - 04:32:28 EST
On Mon, Oct 13, 2008 at 12:34:41AM -0700, David Miller wrote:
> From: David Miller <davem@xxxxxxxxxxxxx>
> Date: Sun, 05 Oct 2008 15:30:59 -0700 (PDT)
>
> > From: swivel@xxxxxxxxxxxxxxxxxxxxxxxx
> > Date: Sun, 5 Oct 2008 16:45:57 -0500
> >
> > > I will be testing this patch today. At a glance it appears with this
> > > patch we're still not taking rcvlowat into consideration in recv()
> > > with MSG_PEEK flag set. This should probably also be corrected, as
> > > mentioned in the thread previously.
> >
> > Yes, I remember you mentioning that.
> >
> > I'll look into it.
>
> Were you able to test my updated patch?
>
> If it makes your application work, I might want to defer messing around
> with MSG_PEEK semantics in recvmsg().
>
> So I've been waiting for your test results before I proceed.
Didn't test your latest patch after you mentioned that you had tested it
yourself successfully.
The application is still broken having recv() not behave normally with
the MSG_PEEK flag. The app will spin calling recv() repeatedly once any
data has made it into the rcvbuf, because recv() will always immediately
return with the >0 # of bytes in the buffer.
I'm using the pseudo-blocking recv() behavior achieved with SO_RCVTIMEO.
Thus my app expects recv() to block until SO_RCVLOWAT is met or SO_RCVTIMEO
expired. Upon timeout expiration recv() is supposed to return -1 with
errno=EAGAIN. With recv() immediately returning on MSG_PEEK there's no
possibility for timeout expiration. recv() behaves perfectly in this
regard without MSG_PEEK, it just needs some minor adjustment to behave
the same with MSG_PEEK specified.
There's a simple diagram illustrating the application implementation
in general. This may help understand the implications of recv() not
blocking once there is data in the rcvbuf without wasting much of your
time:
http://serverkit.org/modules/httpx/httpx.png
Thanks for the follow-up.
Regards,
Vito Caputo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/