!92 回合补丁,修复iowait计数器减少时mpstat报iowait高的问题
From: @jinzig Reviewed-by: @dillon_chen Signed-off-by: @dillon_chen
This commit is contained in:
commit
e840430a22
59
backport-Workaround-for-iowait-being-decremented.patch
Normal file
59
backport-Workaround-for-iowait-being-decremented.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From 6ab627493544c685823f63b74636e82981d96ea8 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Pavlu <petr.pavlu@suse.com>
|
||||
Date: Wed, 2 Sep 2020 10:24:43 +0200
|
||||
Subject: [PATCH] Workaround for iowait being decremented
|
||||
|
||||
The iowait value reported by the kernel on NO_HZ systems can decrement
|
||||
as a result of inaccurate iowait tracking. Waiting on IO can be first
|
||||
accounted as iowait but then instead as idle.
|
||||
|
||||
Function get_per_cpu_interval() considers iowait going backwards between
|
||||
two readings as a CPU coming back online and resets the iowait value of
|
||||
the first reading to 0. If iowait is decremented only because of
|
||||
inaccurate tracking, this causes that almost all time between the two
|
||||
readings is incorrectly recognized by sar as being spent in iowait.
|
||||
|
||||
The patch updates the code in get_per_cpu_interval() to recognize this
|
||||
situation. If the iowait value between two readings decremented but the
|
||||
idle value did not then the code now considers it as a problem with the
|
||||
iowait reporting and corrects the first value according to the second
|
||||
reading. Otherwise, the code remains treating decremented iowait as a
|
||||
CPU coming back online.
|
||||
|
||||
Fixes #14.
|
||||
---
|
||||
rd_stats.c | 18 +++++++++++++++---
|
||||
1 files changed, 15 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/rd_stats.c b/rd_stats.c
|
||||
index 56d42d00..be762450 100644
|
||||
--- a/rd_stats.c
|
||||
+++ b/rd_stats.c
|
||||
@@ -440,12 +440,24 @@ unsigned long long get_per_cpu_interval(struct stats_cpu *scc,
|
||||
* value was greater than ULLONG_MAX - 0x7ffff (the counter probably
|
||||
* overflew).
|
||||
*/
|
||||
+ if ((scc->cpu_iowait < scp->cpu_iowait) && (scp->cpu_iowait < (ULLONG_MAX - 0x7ffff))) {
|
||||
+ /*
|
||||
+ * The iowait value reported by the kernel can also decrement as
|
||||
+ * a result of inaccurate iowait tracking. Waiting on IO can be
|
||||
+ * first accounted as iowait but then instead as idle.
|
||||
+ * Therefore if the idle value during the same period did not
|
||||
+ * decrease then consider this is a problem with the iowait
|
||||
+ * reporting and correct the previous value according to the new
|
||||
+ * reading. Otherwise, treat this as CPU coming back online.
|
||||
+ */
|
||||
+ if (scc->cpu_idle > scp->cpu_idle)
|
||||
+ scp->cpu_iowait = scc->cpu_iowait;
|
||||
+ else
|
||||
+ scp->cpu_iowait = 0;
|
||||
+ }
|
||||
if ((scc->cpu_idle < scp->cpu_idle) && (scp->cpu_idle < (ULLONG_MAX - 0x7ffff))) {
|
||||
scp->cpu_idle = 0;
|
||||
}
|
||||
- if ((scc->cpu_iowait < scp->cpu_iowait) && (scp->cpu_iowait < (ULLONG_MAX - 0x7ffff))) {
|
||||
- scp->cpu_iowait = 0;
|
||||
- }
|
||||
|
||||
/*
|
||||
* Don't take cpu_guest and cpu_guest_nice into account
|
||||
@ -1,6 +1,6 @@
|
||||
Name: sysstat
|
||||
Version: 12.2.1
|
||||
Release: 9
|
||||
Release: 10
|
||||
Summary: System performance tools for the Linux operating system
|
||||
License: GPLv2+
|
||||
URL: http://sebastien.godard.pagesperso-orange.fr/
|
||||
@ -12,6 +12,7 @@ Patch6002: backport-0002-CVE-2023-33204.patch
|
||||
Patch6003: backport-0003-CVE-2023-33204.patch
|
||||
Patch6004: backport-Try-to-avoid-negative-values.patch
|
||||
Patch6005: backport-Try-to-avoid-some-more-negative-values.patch
|
||||
Patch6006: backport-Workaround-for-iowait-being-decremented.patch
|
||||
|
||||
BuildRequires: gcc, gettext, lm_sensors-devel, systemd
|
||||
|
||||
@ -95,6 +96,9 @@ fi
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%changelog
|
||||
* Thu May 23 2024 jinzhiguang <jinzhiguang@kylinos.cn> - 12.2.1-10
|
||||
- Fix the problem of mpstat showing extremely high iowait when iowait counter decreases.
|
||||
|
||||
* Thu Feb 29 2024 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 12.2.1-9
|
||||
- Fix the incorrect command 'is-enable' to 'is-enabled'.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user