Re: [PATCH 6.8 015/715] io_uring: remove unconditional looping in local task_work handling

Jens Axboe
2024-04-02T13:41:39Z

On 4/2/24 2:12 AM, Jiri Slaby wrote:
> On 24. 03. 24, 23:23, Sasha Levin wrote:
>> From: Jens Axboe <axboe@kernel.dk>
>>
>> [ Upstream commit 9fe3eaea4a3530ca34a8d8ff00b1848c528789ca ]
>>
>> If we have a ton of notifications coming in, we can be looping in here
>> for a long time. This can be problematic for various reasons, mostly
>> because we can starve userspace. If the application is waiting on N
>> events, then only re-run if we need more events.
>
> This commit breaks test/recv-multishot.c from liburing:
> early error: res 4
> test stream=1 wait_each=0 recvmsg=0 early_error=0 defer=1 failed
>
> The behaviour is the same in 6.9-rc2 (which contains the commit too).
>
> Reverting the commit on the top of 6.8.2 makes it pass again.
>
> Should the test be updated or is the commit wrong?

The commit is fine, it's the test that is buggy. Sometimes test cases
make odd assumptions that are just wrong but happen to work, for some
definition of work. Eg it would work fine on an idle system, but not
necessarily if not. For this one, the fix is in liburing:

https://git.kernel.dk/cgit/liburing/commit/test/recv-multishot.c?id=a1d5e4b863a60af93d0cab9d4bbf578733337a90

--
Jens Axboe