[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240122233534.3094238-1-tim.c.chen@linux.intel.com>
Date: Mon, 22 Jan 2024 15:35:34 -0800
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: Heiko Carstens <hca@...ux.ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Frederic Weisbecker <frederic@...nel.org>
Cc: Tim Chen <tim.c.chen@...ux.intel.com>,
Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
linux-kernel@...r.kernel.org,
linux-s390@...r.kernel.org
Subject: [PATCH] tick-sched: Preserve number of idle sleeps across CPU hotplug events
Patch 71fee48f ("tick-sched: Fix idle and iowait sleeptime accounting vs
CPU hotplug") preserved total idle sleep time and iowait sleeptime
across CPU hotplug events.
In order to derive average sleep time per sleep event, we should also
preserve number of sleeps too in idle_calls and idle_sleeps. Fix that.
Fixes: 71fee48f ("tick-sched: Fix idle and iowait sleeptime accounting vs CPU hotplug")
Signed-off-by: Tim Chen <tim.c.chen@...ux.intel.com>
---
kernel/time/tick-sched.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index d2501673028d..01fb50c1b17e 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -1577,6 +1577,7 @@ void tick_cancel_sched_timer(int cpu)
{
struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
ktime_t idle_sleeptime, iowait_sleeptime;
+ unsigned long idle_calls, idle_sleeps;
# ifdef CONFIG_HIGH_RES_TIMERS
if (ts->sched_timer.base)
@@ -1585,9 +1586,13 @@ void tick_cancel_sched_timer(int cpu)
idle_sleeptime = ts->idle_sleeptime;
iowait_sleeptime = ts->iowait_sleeptime;
+ idle_calls = ts->idle_calls;
+ idle_sleeps = ts->idle_sleeps;
memset(ts, 0, sizeof(*ts));
ts->idle_sleeptime = idle_sleeptime;
ts->iowait_sleeptime = iowait_sleeptime;
+ ts->idle_calls = idle_calls;
+ ts->idle_sleeps = idle_sleeps;
}
#endif
--
2.32.0
Powered by blists - more mailing lists