libvirt/SOURCES/libvirt-util-Look-for-newer-name-of-cpu-wait-time-statistic.patch
2025-01-08 15:10:41 +03:00

45 lines
1.9 KiB
Diff

From a75fd28107feb17f408b4fd2358fb68242c7cad9 Mon Sep 17 00:00:00 2001
Message-ID: <a75fd28107feb17f408b4fd2358fb68242c7cad9.1729611062.git.jdenemar@redhat.com>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Thu, 3 Oct 2024 17:00:48 +0200
Subject: [PATCH] util: Look for newer name of cpu wait time statistic
It looks like linux changed the key for wait time in /proc/<pid>/sched
and /proc/<pid>/task/<tid>/sched files in commit ceeadb83aea2 (or around
that time) from se.statistics.wait_sum to just wait_sum. Similarly to
the previous change (from se.wait_sum) just look for the new name first.
Resolves: https://issues.redhat.com/browse/RHEL-60030
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 215cada34395b6b2caad507393e043594d6c86fc)
https://issues.redhat.com/browse/RHEL-61511
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
src/util/virprocess.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index f1e5e4decd..05db76d834 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -1848,9 +1848,11 @@ virProcessGetSchedInfo(unsigned long long *cpuWait,
for (i = 0; lines[i] != NULL; i++) {
const char *line = lines[i];
- /* Needs CONFIG_SCHEDSTATS. The second check
- * is the old name the kernel used in past */
- if (STRPREFIX(line, "se.statistics.wait_sum") ||
+ /* Needs CONFIG_SCHEDSTATS. The second check is the name used before
+ * kernel commit ceeadb83aea2, the third one is the old name the kernel
+ * used in past */
+ if (STRPREFIX(line, "wait_sum") ||
+ STRPREFIX(line, "se.statistics.wait_sum") ||
STRPREFIX(line, "se.wait_sum")) {
line = strchr(line, ':');
if (!line) {
--
2.47.0