Re: aio poll, io_pgetevents and a new in-kernel poll API V4

From: Christoph Hellwig
Date: Fri Jan 26 2018 - 07:31:48 EST


On Thu, Jan 25, 2018 at 03:10:25PM -0500, Benjamin LaHaise wrote:
> I implemented something similar back in December, but did so without
> changing the in-kernel poll API. See below for the patch that implements
> it. Is changing the in-kernel poll API really desirable given how many
> drivers that will touch?

I had various previous versions that did not touch the driver API,
but there are a couple issues with that:

(1) you cannot make the API race free. With the existing convoluted
poll_table_struct-based API you can't check for pending items
before adding yourself to the waitqueue in a race free manner.
(2) you cannot make the submit non-blocking without deferring to
a workqueue or similar and thus incurring another context switch
(3) you cannot deliver events from the wakeup callback, incurring
another context switch, this time in the wakeup path that actually
matters for some applications
(3) the in-kernel poll API really is broken to start with and needs
to be fixed anyway. I'd rather rely on that instead of working
around decades old cruft that has no reason to exist.