From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id CB10C80726 for ; Wed, 14 Oct 2026 11:18:03 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69EBGqiG031158; Wed, 14 Oct 2026 14:16:53 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69EBGqiG031158 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="NuV/gtSU" Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69EBGaZc031117 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 14 Oct 2026 14:16:36 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69EBGaZc031117 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4a01b112fa2so12943585e9.1 for ; Wed, 14 Oct 2026 04:16:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBxtbThfCxR1XeYavn/1ogtev0uLZyMKiIXi0DEy0u/9gXfZbc6R7fkNmyhEvzlrRUZEWjfS5g==@openvz.org X-Gm-Message-State: AFq9FYL/OjBqFYJ3LeA70RNcyjKWqc3uQ3xAUaRO57nJIlRoe9wu6H7H Mx1U/Zv+iQY7yM984lpz5c9bkXXjjf+zAhbGmLpOKB23DVueL8BhbmhOtbpnWBULTOPIqURjEhf o2iD4Gi2kDjZmEqJr+qStAw1DXUQCZBGcw9xi4p7j/EfU1bzu0w1gzQ== X-Gm-Gg: AYBFou3q+c+YrVnPim0c9OLv6EbjWrJdc/apRbgjjynM4IhsBY8h7EVmmE+a6JJ/zv+ b5o3zBU+j0HnBW4nKpBjCpvXFf7zR7N4KzQ1LCQ5CVCRKffmY7Cbd742ssQiFs1mR/0w5HJqiGO d34fpPmNfCySQBeoqd+POtn9wCPI9sUS86PpwKoKIiTeOZjfdLPXUow/XWRRODg/FU1oh7pEzap n6D4lzfeNPbImDUO8+OvvHBjKGf55HzKVnDKMm1Ca8+VIUbpQ1z4vmh4DLyPD53Val/wXVScd2i bUqAMOu6WdgyA9PHv6cShhWxye+1w5rON/zx/qhRt26+pWZ+znyjjOU9HIES8DDNTShIyFS06FB DK9FsGjpiaE3U64bugVksOwshBskqFeA= X-Received: by 2002:a05:600c:8b06:b0:4a1:7ce1:2eaf with SMTP id 5b1f17b1804b1-4a18e4e0963mr312841695e9.34.1791976596266; Wed, 14 Oct 2026 04:16:36 -0700 (PDT) X-Received: by 2002:a05:600c:8b06:b0:4a1:7ce1:2eaf with SMTP id 5b1f17b1804b1-4a18e4e0963mr312840975e9.34.1791976595591; Wed, 14 Oct 2026 04:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791976595; cv=none; d=google.com; s=arc-20260327; b=dIijKof1EB9vkmhyHrpuVJrtKZwHsGNSUEoGdPl4a1VqHsQkDht8vGE+NBpSB7nawI U5gAtnd48henrpgDmQij8QJezXbOHGU1jWiEmvhRiluAK1/QWLJxu+/5Ayf0089YFCJz hR/1qcU4/5m2pJ9tY4o3CmlDviZRNVH9fX8GYqEurt0jM5yeTSe3RBSjSQAu2BUfO/N+ Cnnl+6QGhAty+SStA5/Wd3TVgUNHXlmeG51bylwImegLrTe63fRuIlSUItdg33zRMW1o bZFwiB61ZgFO33s7EQjub/yAeBR98dikZUPXQWv5pRttxM+KV4Bjm1XdciBG9gdqmFX8 W7aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=pWXsxpycjRa8TYKukzSC2FCSlIRb8Odr4NdSCBXQQF8=; fh=YUVjC/9FtpTN0Is9ifTJrOsbz/J/onroleA8inR1Ce8=; b=rL4PW12Lcm4ZwPHz492yS1JQG26ZWbUeRMAHAMK+4qHlasQveDnmp9pMZjtg43mOoy cvXj6R53h3Bwqww1YvZqpFGHfkoEmO+YtdWgFkvlD4aDZk6OVbsSTk4YhUAn2m30c0MI QaOlUo7NkXJp0paPdPdRlugZLZPj3OPZgmpAWrp+6+RSy43pz9cTA6oBVQI5lXrQu4Km wSsFhVVunK0mxHrgm62ZE+sAHPhveExWvueYoq5cl6pe2jbCX8TrJa8rWVueFCl59kzQ WINe6gniQRAOTorrYs9+DNt/XTMe/fC352d+97UpR+Xz5+lgpj58ZbvU+Uej1eXpmn6m UKBg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b="NuV/gtSU"; spf=pass (google.com: domain of vasileios.almpanis@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=vasileios.almpanis@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48de0c16e30si17006849f8f.458.2026.10.14.04.16.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2026 04:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of vasileios.almpanis@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b="NuV/gtSU"; spf=pass (google.com: domain of vasileios.almpanis@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=vasileios.almpanis@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Message-Id:Content-Type:MIME-Version:Subject:Date :From; bh=pWXsxpycjRa8TYKukzSC2FCSlIRb8Odr4NdSCBXQQF8=; b=NuV/gtSUQ0vFX8mUVUk LfF4yawDWTH2FXwTI1oR2kzJNB8FmC1lpnyb3uvNfJqAqpGfW3Ax7Z+FvbJ4frgEyumaEVbxUAWn0 XxFHSdRR+K9yZadD/31l1VaVMuNh1/3jjSZbCe2w8YVPFYfdewCN/o6msqzjBSA7hDpsOO5KtD0p0 vQKk5iV2lTpn9EFDxjTvG7ItFudjXXEFqtEzDJcw0RKPU2aSMAv9LRhtkOW466fUtNayrcY8MDSxh SX2eUd3zPlWVgRJZf6tvwr/D4QS1J7lA3qcPS2DeQH2vsSbkHGMkyrHEpinysaWfR21BFmu6/xMvO RtYLv7P9LZU1Kyg==; Received: from [130.117.225.5] (helo=dev010.ch-qa.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xGwus-001CVN-1a; Wed, 14 Oct 2026 13:16:34 +0200 From: Vasileios Almpanis Date: Wed, 14 Oct 2026 11:16:27 +0000 MIME-Version: 1.0 Message-Id: <20261014-ct-iowait-v1-4-9d65fe37cf89@virtuozzo.com> References: <20261014-ct-iowait-v1-0-9d65fe37cf89@virtuozzo.com> In-Reply-To: <20261014-ct-iowait-v1-0-9d65fe37cf89@virtuozzo.com> To: Konstantin Khorenko , Pavel Tikhomirov X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1791976595; l=3003; i=vasileios.almpanis@virtuozzo.com; s=20260812; h=from:subject:message-id; bh=DSOYX+3wwvKud15qA5G7mR1cZAtY/1N+CBVNKRRcj3w=; b=DELn4+97KEx7JFxfpM7AdMqh3S2Kj0qJUkcL8dPmW3EWlvUFjLWEpvdBHIfFhZkjCTKUxrwHS m9UfwENuA5KAQpQb1XLfttLpUd8tIXHrGT5I6JpKGa7QYvILxlhrkRV X-Developer-Key: i=vasileios.almpanis@virtuozzo.com; a=ed25519; pk=HhuHDXAcPva9A8zccWEMRsb36reu+y4IVbBjXKxNUjw= X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 4/4] sched: switch a sleeping task group entity between idle and iowait X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org A sleeping group entity is accounted as blocked if its cfs_rq had iowait sleepers when it was dequeued and as idle otherwise. But nr_iowait can change while the group sleeps, e.g. when its iowait task wakes up on another CPU, moves to another cgroup or changes its class. The group then keeps accounting iowait on a CPU where nothing waits for IO anymore. Fix it like vz7 nr_iowait_{inc,dec}_fair() did: when nr_iowait changes, close the current period of the sleeping group and start the other kind. This needs an up to date rq clock, so update it in the migrating wakeup path of try_to_wake_up(). The other callers already do it. https://virtuozzo.atlassian.net/browse/VSTOR-147823 Signed-off-by: Vasileios Almpanis Feature: sched: emulate virtual cpus for Containers --- kernel/sched/core.c | 1 + kernel/sched/fair.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 1acb98c0e8fa..77587e9982b7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4376,6 +4376,7 @@ int try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) struct rq *rq; rq = __task_rq_lock(p, &rf); + update_rq_clock(rq); p->sched_class->nr_iowait_dec(p); __task_rq_unlock(rq, &rf); } diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 2df5a9b47480..9f76caefc64a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -13694,11 +13694,40 @@ static unsigned int get_rr_interval_fair(struct rq *rq, struct task_struct *task } #ifdef CONFIG_FAIR_GROUP_SCHED +/* + * A sleeping group entity is accounted as blocked while its cfs_rq has + * iowait sleepers and as idle otherwise. Switch it when nr_iowait changes + * without an enqueue, e.g. the iowait task wakes up on another CPU. + */ +static void nr_iowait_update_group(struct cfs_rq *cfs_rq, + struct sched_entity *se) +{ + struct sched_statistics *stats; + struct rq *rq; + + if (!schedstat_enabled() || !se) + return; + + rq = rq_of(cfs_rq); + stats = __schedstats_from_se(se); + if (cfs_rq->nr_iowait ? !schedstat_val(stats->sleep_start) : + !schedstat_val(stats->block_start)) + return; + + __update_stats_enqueue_sleeper(rq, NULL, stats); + + if (cfs_rq->nr_iowait) + __schedstat_set(stats->block_start, rq_clock(rq)); + else + __schedstat_set(stats->sleep_start, rq_clock(rq)); +} + static void nr_iowait_dec_fair(struct task_struct *p) { struct cfs_rq *cfs_rq = task_cfs_rq(p); cfs_rq->nr_iowait--; + nr_iowait_update_group(cfs_rq, p->se.parent); } static void nr_iowait_inc_fair(struct task_struct *p) @@ -13706,6 +13735,7 @@ static void nr_iowait_inc_fair(struct task_struct *p) struct cfs_rq *cfs_rq = task_cfs_rq(p); cfs_rq->nr_iowait++; + nr_iowait_update_group(cfs_rq, p->se.parent); } #endif /* CONFIG_FAIR_GROUP_SCHED */ -- 2.43.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel