Re: [PATCH 3/3] IO_URING: Statistics of the true utilization of sq threads.

From: Jens Axboe
Date: Thu Sep 28 2023 - 04:41:33 EST


On 9/28/23 2:37 AM, Matthew Wilcox wrote:
> On Thu, Sep 28, 2023 at 10:01:14AM +0200, Peter Zijlstra wrote:
>> Now, I see what you're trying to do, but who actually uses this data?
>
> I ... don't. There seems to be the notion that since we're polling, that
> shouldn't count against the runtime of the thread. But the thread has
> chosen to poll! It is doing something! For one thing, it's preventing
> the CPU from entering an idle state. It seems absolutely fair to
> accuont this poll time to the runtime of the thread. Clearly i'm
> missing something.

For sure, it should be accounted as CPU time, as it is exactly that. You
could argue that if we needed to preempt this task for something else we
would do that (and the code does check that on every loop), but it's
still using CPU.

I can see maybe wanting to know how much of the total time the thread
spent doing ACTUAL work rather than just polling for new work, but
that's not really something the scheduler should be involved in and
should be purely an io_uring sqpoll stat of some sort if that is truly
interesting for an application.

--
Jens Axboe