Re: [PATCH] aio: make aio wait path to account iowait time

From: Jan Kara
Date: Fri Aug 28 2020 - 05:41:36 EST


On Fri 28-08-20 11:07:29, peterz@xxxxxxxxxxxxx wrote:
> On Fri, Aug 28, 2020 at 02:07:12PM +0800, Xianting Tian wrote:
> > As the normal aio wait path(read_events() ->
> > wait_event_interruptible_hrtimeout()) doesn't account iowait time, so use
> > this patch to make it to account iowait time, which can truely reflect
> > the system io situation when using a tool like 'top'.
>
> Do be aware though that io_schedule() is potentially far more expensive
> than regular schedule() and io-wait accounting as a whole is a
> trainwreck.

Hum, I didn't know that io_schedule() is that much more expensive. Thanks
for info.

> When in_iowait is set schedule() and ttwu() will have to do additional
> atomic ops, and (much) worse, PSI will take additional locks.
>
> And all that for a number that, IMO, is mostly useless, see the comment
> with nr_iowait().

Well, I understand the limited usefulness of the system or even per CPU
percentage spent in IO wait. However whether a particular task is sleeping
waiting for IO or not is IMO a useful diagnostic information and there are
several places in the kernel that take that into account (PSI, hangcheck
timer, cpufreq, ...). So I don't see that properly accounting that a task
is waiting for IO is just "expensive random number generator" as you
mention below :). But I'm open to being educated...

> But, if you don't care about performance, and want to see a shiny random
> number generator, by all means, use io_schedule().

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR