lkml.org 
[lkml]   [2020]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 1/2] tick-sched: Do not clear the iowait and idle times
Date
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@oracle.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
\
 
 \ /
  Last update: 2020-09-15 21:37    [W:0.025 / U:4.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site