sched/core: switch struct rq->nr_iowait to a normal int
authorJens Axboe <axboe@kernel.dk>
Tue, 27 Feb 2024 20:44:05 +0000 (13:44 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 28 Feb 2024 19:13:48 +0000 (12:13 -0700)
commitfd7eca408b70415870b002aadc019e1dc6c8001e
tree97d61c5832316f221898d5f0534827b2883f9610
parent45ec2f5f6ed3ec3a79ba1329ad585497cdcbe663
sched/core: switch struct rq->nr_iowait to a normal int

In 3 of the 4 spots where we modify rq->nr_iowait we already hold the
rq lock, and hence don't need atomics to modify the current per-rq
iowait count. In the 4th case, where we are scheduling in on a different
CPU than the task was previously on, we do not hold the previous rq lock,
and hence still need to use an atomic to increment the iowait count.

Rename the existing nr_iowait to nr_iowait_remote, and use that for the
4th case. The other three cases can simply inc/dec in a non-atomic
fashion under the held rq lock.

The per-rq iowait now becomes the difference between the two, the local
count minus the remote count.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
kernel/sched/core.c
kernel/sched/cputime.c
kernel/sched/sched.h