lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200915193627.85423-2-tom.hromatka@oracle.com>
Date:   Tue, 15 Sep 2020 13:36:26 -0600
From:   Tom Hromatka <tom.hromatka@...cle.com>
To:     tom.hromatka@...cle.com, linux-kernel@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, fweisbec@...il.com,
        tglx@...utronix.de, mingo@...nel.org, adobriyan@...il.com
Subject: [PATCH v2 1/2] tick-sched: Do not clear the iowait and idle times

Prior to this commit, the cpu idle and iowait data in /proc/stat were
cleared when a CPU goes down.  When the CPU came back online, both idle
and iowait times were restarted from 0.

This commit preserves the CPU's idle and iowait values when a CPU goes
offline and comes back online.

Signed-off-by: Tom Hromatka <tom.hromatka@...cle.com>
---
 kernel/time/tick-sched.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index f0199a4ba1ad..4fbf67171dde 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -1383,13 +1383,22 @@ void tick_setup_sched_timer(void)
 void tick_cancel_sched_timer(int cpu)
 {
 	struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
+	ktime_t idle_sleeptime, iowait_sleeptime;
 
 # ifdef CONFIG_HIGH_RES_TIMERS
 	if (ts->sched_timer.base)
 		hrtimer_cancel(&ts->sched_timer);
 # endif
 
+	/*
+	 * Preserve idle and iowait sleep times accross a CPU offline/online
+	 * sequence as they are accumulative.
+	 */
+	idle_sleeptime = ts->idle_sleeptime;
+	iowait_sleeptime = ts->iowait_sleeptime;
 	memset(ts, 0, sizeof(*ts));
+	ts->idle_sleeptime = idle_sleeptime;
+	ts->iowait_sleeptime = iowait_sleeptime;
 }
 #endif
 
-- 
2.25.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ