Re: [PATCH v2] fs/aio: obey min_nr when doing wakeups

From: Jeff Moyer
Date: Mon Jan 23 2023 - 11:14:50 EST


Jeff Moyer <jmoyer@xxxxxxxxxx> writes:

> Hi, Kent,
>
> Kent Overstreet <kent.overstreet@xxxxxxxxx> writes:
>
>> I've been observing workloads where IPIs due to wakeups in
>> aio_complete() are ~15% of total CPU time in the profile. Most of those
>> wakeups are unnecessary when completion batching is in use in
>> io_getevents().
>>
>> This plumbs min_nr through via the wait eventry, so that aio_complete()
>> can avoid doing unnecessary wakeups.
>>
>> v2: This fixes a race in the first version of the patch. If we read some
>> events out after adding to the waitlist, we need to update wait.min_nr
>> call prepare_to_wait_event() again before scheduling.
>
> I like the idea of the patch, and I'll get some real world performance
> numbers soon. But first, this version (and the previous version as
> well) fails test case 23 in the libaio regression test suite:
>
> Starting cases/23.p
> FAIL: poll missed an event!
> FAIL: poll missed an event!
> test cases/23.t completed FAILED.

It turns out that this only fails on the (relatively) old kernel against
which I applied the patches. When I apply both patches to the latest
tree, there is no test failure.

Sorry for the noise, I'll be sure to test on the latest going forward.
Now to figure out what changed elsewhere to fix this....

Cheers,
Jeff