Re: sleeps and waits during io_submit

Avi Kivity
2015-12-01T19:50:43Z

On 12/01/2015 09:41 PM, Christoph Hellwig wrote:
> On Tue, Dec 01, 2015 at 09:26:42PM +0200, Avi Kivity wrote:
>> It's basically the same thing. To to this, we'd have get_block either
>> return the block's address (if it was in some metadata cache), or, if it was
>> not, issue an I/O that fills (part of) that cache, and as its completion
>> function, a continuation that reruns __blockdev_direct_IO from the point it
>> was stopped so it can submit the data I/O (if the metadata cache was
>> completely updated) or issue the next I/O aiming to fill that metadata
>> cache, if it was not.
> We did something this for blocking reads with great results, and it could be
> done similarly for direct I/O I think:
>
> https://lwn.net/Articles/612483/
>
> Unfortunately Andrew shut it down for odd reasons so it didn't get in.

How would this work? io_submit() returns -ENOTALLMETADATAISINCACHE,
user calls io_submit() again from a worker thread, where he doesn't mind
blocking?

In fact sys_io_submit() could catch this error and resubmit the I/O on
its own using a work item, and io_submit() would become non-blocking, at
least on I/O (lock contention may still be a problem, but a smaller one).