[PATCHSET v3 0/2] Split iowait into two states

From: Jens Axboe
Date: Wed Feb 28 2024 - 14:24:10 EST


Hi,

This is v3 of the patchset where the current in_iowait state is split
into two parts:

1) The "task is sleeping waiting on IO", and would like cpufreq goodness
in terms of sleep and wakeup latencies.
2) The above, and also accounted as such in the iowait stats.

The current ->in_iowait covers both, with this series we have ->in_iowait
for step 1 above, and ->in_iowait_acct for step 2. You cannot be
->in_iowait_acct without also having ->in_iowait set.

Patch 1 is a prep patch, that turns rq->nr_iowait into an int rather than
an atomic_t. Reasons given in that patch. This patch can stand alone, as
it should not have any functional changes, outside of improving the
handling of iowait a bit.

Patch 2 adds the ->in_iowait_acct stage inside the current ->in_iowait
setting.

I wasn't super happy with the need to grab the rq lock for the one case
where we still need it, and woke up with a better idea of how to do this.
It's all in patch 1. Nice part here is that we get rid of atomics for
3 out of the 4 iowait inc/dec. Patch just follows the same principle.

Comments welcome! Peter, CC'ing you since I did on the previous posting,
feel free to ignore.

Since v2:
- Drop need for rq lock for the remote case by turning both nr_iowait
and nr_iowait_acct into the difference between a remote atomic count
and the local non-atomic one.

--
Jens Axboe