[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> --- src/util/virprocess.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virprocess.c b/src/util/virprocess.c index f1e5e4decd68..dd4bd866102e 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -1849,8 +1849,10 @@ virProcessGetSchedInfo(unsigned long long *cpuWait, const char *line = lines[i]; /* Needs CONFIG_SCHEDSTATS. The second check + * is the name used before ceeadb83aea2, the third one * is the old name the kernel used in past */ - if (STRPREFIX(line, "se.statistics.wait_sum") || + if (STRPREFIX(line, "wait_sum") || + STRPREFIX(line, "se.statistics.wait_sum") || STRPREFIX(line, "se.wait_sum")) { line = strchr(line, ':'); if (!line) { -- 2.46.2

On Thu, Oct 03, 2024 at 17:06:55 +0200, Martin Kletzander wrote:
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> --- src/util/virprocess.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/virprocess.c b/src/util/virprocess.c index f1e5e4decd68..dd4bd866102e 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -1849,8 +1849,10 @@ virProcessGetSchedInfo(unsigned long long *cpuWait, const char *line = lines[i];
/* Needs CONFIG_SCHEDSTATS. The second check + * is the name used before ceeadb83aea2, the third one
Perhaps 'kernel commit ceea...'?
* is the old name the kernel used in past */ - if (STRPREFIX(line, "se.statistics.wait_sum") || + if (STRPREFIX(line, "wait_sum") || + STRPREFIX(line, "se.statistics.wait_sum") || STRPREFIX(line, "se.wait_sum")) { line = strchr(line, ':'); if (!line) {
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
participants (2)
-
Martin Kletzander
-
Peter Krempa