sched/core: split iowait state into two states iowait.3
authorJens Axboe <axboe@kernel.dk>
Sun, 25 Feb 2024 21:26:21 +0000 (14:26 -0700)
committerJens Axboe <axboe@kernel.dk>
Sat, 17 Aug 2024 20:41:06 +0000 (14:41 -0600)
commit48adfbb63455fa4db5d08413b5492725173cc52c
tree204c055c16f6e6c55dc81bfdb0b3550bbaea629e
parentdef62938bb96e03448773e256ade12449d69bdd9
sched/core: split iowait state into two states

iowait is a bogus metric, but it's helpful in the sense that it allows
short waits to not enter sleep states that have a higher exit latency
than would've otherwise have been picked for iowait'ing tasks. However,
it's harmless in that lots of applications and monitoring assumes that
iowait is busy time, or otherwise use it as a health metric.
Particularly for async IO it's entirely nonsensical.

Split the iowait part into two parts - one that tracks whether the task
needs boosting for short waits, and one that marks whether the task
needs to be accounted as such. ->in_iowait_acct nests inside of
->in_iowait, both for efficiency reasons, but also so that the
relationship between the two is clear. A waiter may set ->in_wait alone
and not care about the accounting.

Existing users of nr_iowait() for accounting purposes are switched to
use nr_iowait_acct(), which leaves the governor using nr_iowait() as it
only cares about iowaiters, not the accounting side.

Utilize that there's enough space in rq->nr_iowait to store both values
in there, shifting the accounting side by half the size of the type.
Thank you to Thomas Gleixner for that [1] suggestion.

[1] https://lore.kernel.org/lkml/87sf1b6o9w.ffs@tglx/

Signed-off-by: Jens Axboe <axboe@kernel.dk>
arch/s390/appldata/appldata_base.c
arch/s390/appldata/appldata_os.c
fs/proc/stat.c
include/linux/sched.h
include/linux/sched/stat.h
kernel/sched/core.c
kernel/sched/sched.h
kernel/time/tick-sched.c