OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
To: Konstantin Khorenko <khorenko@virtuozzo.com>,
	Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 0/4] sched: restore Container iowait accounting
Date: Wed, 14 Oct 2026 11:16:23 +0000	[thread overview]
Message-ID: <20261014-ct-iowait-v1-0-9d65fe37cf89@virtuozzo.com> (raw)

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@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.

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

             reply	other threads:[~2026-10-14 11:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 11:16 Vasileios Almpanis [this message]
2026-10-14 11:16 ` [Devel] [PATCH hci-8.1 1/4] sched: fix cfs_rq::nr_iowait leak on the remote wakeup path Vasileios Almpanis
2026-10-14 11:23   ` no-reply
2026-10-14 11:16 ` [Devel] [PATCH hci-8.1 2/4] sched: keep cfs_rq::nr_iowait balanced for throttled and class changing tasks Vasileios Almpanis
2026-10-14 11:24   ` no-reply
2026-10-14 11:16 ` [Devel] [PATCH hci-8.1 3/4] sched: account sleep and block time of a task group entity Vasileios Almpanis
2026-10-14 11:28   ` no-reply
2026-10-14 11:36     ` Vasileios Almpanis
2026-10-14 11:16 ` [Devel] [PATCH hci-8.1 4/4] sched: switch a sleeping task group entity between idle and iowait Vasileios Almpanis
2026-10-14 11:27   ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261014-ct-iowait-v1-0-9d65fe37cf89@virtuozzo.com \
    --to=vasileios.almpanis@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    --cc=ptikhomirov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox