[Devel] [PATCH hci-8.1 0/4] sched: restore Container iowait accounting

Vasileios Almpanis vasileios.almpanis at virtuozzo.com
Wed Oct 14 14:16:23 MSK 2026


Container iowait is always 0 on vz10, both in cpu.proc.stat and in the
CT's /proc/stat, so top inside a CT shows 0 wa.

Two things are broken. cfs_rq::nr_iowait goes out of balance on a few
paths, and the group entity never gets sleep_start/block_start, so
neither idle nor iowait is accounted for the group. The counter has to
be fixed first, otherwise the groups would look blocked forever.

Patch 1 fixes the nr_iowait leak on the remote wakeup path.
Patch 2 fixes nr_iowait for throttled and class changing tasks.
Patch 3 accounts sleep and block time of the group entity.
Patch 4 switches a sleeping group between idle and iowait.

The accounting depends on kernel.sched_schedstats=1, same as on vz7.

Known issues:
 - If kernel.sched_schedstats is switched off while a group entity has
   an open sleep or block period, the stamp stays set and cpu.proc.stat
   keeps adding idle or iowait until the group is enqueued again, even
   after schedstats are back on. This can be fixed separately by
   clearing the stamps in set_schedstats().
 - cfs_rq::nr_iowait is not hierarchical, so a CT that runs its IO in
   nested cpu cgroups shows it as idle.

Tested on a vz10 node with direct IO reads in a CT, with CPU and IO
limits, and with class switches, cgroup moves and affinity changes
during IO. fio shows no difference against the base kernel.

https://virtuozzo.atlassian.net/browse/VSTOR-147823

Signed-off-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
---
Vasileios Almpanis (4):
      sched: fix cfs_rq::nr_iowait leak on the remote wakeup path
      sched: keep cfs_rq::nr_iowait balanced for throttled and class changing tasks
      sched: account sleep and block time of a task group entity
      sched: switch a sleeping task group entity between idle and iowait

 kernel/sched/core.c  | 35 ++++++++++++++++++-----------
 kernel/sched/fair.c  | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 kernel/sched/sched.h | 12 ++++++++++
 3 files changed, 94 insertions(+), 15 deletions(-)
---
base-commit: defa968cbe8c38f1ff0231042dee07f00d27b2c9
change-id: 20261013-ct-iowait-d8e9a32b8135

-- 
Best regards, Vasileios Almpanis
Software Developer, Virtuozzo.



More information about the Devel mailing list