Re: [PATCH] swap: add block io poll in swapin path

Jens Axboe
2017-05-05T13:47:39Z

On 05/05/2017 12:02 AM, Huang, Ying wrote:
>> The hybrid polling could help. The default hybrid polling poll half
>> the average IO latency. But it will not work very well if the latency
>> becomes very big. The hybrid polling has an interface to allow
>> userspace to configure the poll threshold, but since the latency
>> varies from time to time, it would be very hard to set a single
>> threshold for all workloads.
>
> If my understanding were correct, the hybrid polling will insert some
> sleep before the polling, but will not restrict the duration of the
> polling itself. This helps CPU usage, but may not help much for very
> long latency. How about add another threshold to restrict the max
> polling time? For example, the sleep time + max polling time could be
> 1.5 * mean latency. So that most IO requests could be serviced by
> polling, and for very long latency, polling could be restricted to
> reduce CPU usage.

I don't think that's a bad idea at all, there's definitely room for
improvement on how long to sleep and when to completely stop. The stats
track min/avg/max for a given window of time, so it would not be too
hard to implement an appropriate backoff as well.

--
Jens Axboe