[systemd-devel] [PATCH kdbus] handle: Return POLLOUT | POLLWRNORM mask when no messages are pending

Daniel Mack daniel at zonque.org
Mon Aug 18 08:11:17 PDT 2014


On 08/18/2014 04:02 PM, Lennart Poettering wrote:
> On Fri, 15.08.14 14:16, Marcel Holtmann (marcel at holtmann.org) wrote:

>> Blindly sending messages is never a good idea. You want to poll for
>> POLLOUT first. This does not make a big difference for current kernel,
>> but it allows future extensions when the clients are well behaving and
>> just waiting for POLLOUT. Meaning once the kernel does not signal
>> POLLOUT, no new messages will come from the client.
>>
>> Current code does not do this POLLOUT before sending a messages, but
>> our kdbus client actually does that. It is the right thing to do. And
>> we have been doing this with all of our protocols that are using
>> asynchronous IO. No point in kdbus being any different.
> 
> Well, kdbus keeps per-reciever buffers only, hence signalling on the
> kdbus fd when you are able to write is not really possible, since this
> information is not bound to the sender fd but only to the receiever of
> which there are many...

Exactly.

> If I understand you correctly you hence want the
> kdbus fd to always return EPOLLOUT then, because if a client wants to
> send something it can do that at any time?
> 
> If that's the case then POLLOUT should really be ORed into the mask
> unconditionally, not just in some cases...

Yes, except when the connection is dead. I've pushed a patch to do that,
please check.


Thanks,
Daniel



More information about the systemd-devel mailing list