sched/core: split iowait state into two states iowait.4
authorJens Axboe <axboe@kernel.dk>
Sun, 25 Feb 2024 21:26:21 +0000 (14:26 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 19 Aug 2024 14:40:32 +0000 (08:40 -0600)
commit6513dbe31731fac30dd07df656f8de9fd89d2b75
tree059a05a56525c063d32221e1b7b5b3686c69cfdb
parentc046308111c229fc1d73047007f94b72554f2520
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