On 12/9/18 3:02 AM, Benny Halevy wrote:
>> +static int __aio_iopoll_check(struct kioctx *ctx, struct io_event __user
>> *event,
>> + unsigned int *nr_events, long min_nr, long max_nr)
>> +{
>> + int ret = 0;
>> +
>> + while (!*nr_events || !need_resched()) {
>
> Hmm, it doesn't make sense to spin in this loop
> if the user got _all_ the events he requested, even
> if !need_resched(). How about:
>
> while (!*nr_events || (!need_resched() && *nr_events < max_nr)) {
That checking is done io aio_iopoll_getevents(), there are other
conditions where we don't want to spin, like nr_events >= min_nr for
instance. But all that logic is in aio_iopoll_getevents(), from here we
just know that we probably need to continue if nr_events == 0.
I don't think there's an issue here, and no spinning when we don't need
it.
--
Jens Axboe