tick-sched: Preserve number of idle sleeps across CPU hotplug events
Subsystems (3)
PATCH 1/1 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.
--- kernel/time/tick-sched.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/time/tick-sched.c +5 -0
@@ -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
Signature · 1 line
2.32.0
On Mon, Jan 22 2024 at 15:35, Tim Chen wrote:
Frederic Weisbecker
maintainerQuoted 4 lines · Thomas Gleixner
On Mon, Jan 22 2024 at 15:35, Tim Chen wrote:
It's a different patch :-)
Quoted 7 lines · Frederic Weisbecker
Quoted 4 lines · Thomas Gleixner
On Mon, Jan 22 2024 at 15:35, Tim Chen wrote:
It's a different patch :-)
I clearly can't read ....
[tip: timers/urgent] tick/sched: Preserve number of idle sleeps across CPU hotplug events
In reply to Tim ChenThe following commit has been merged into the timers/urgent branch of tip:
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: 9a574ea9069be30b835a3da772c039993c43369b Gitweb: https://git.kernel.org/tip/9a574ea9069be30b835a3da772c039993c43369b Author: Tim Chen <[email protected]> AuthorDate: Mon, 22 Jan 2024 15:35:34 -08:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 25 Jan 2024 09:52:40 +01:00
tick/sched: Preserve number of idle sleeps across CPU hotplug events
Commit 71fee48f ("tick-sched: Fix idle and iowait sleeptime accounting vs CPU hotplug") preserved total idle sleep time and iowait sleeptime across CPU hotplug events.
Similar reasoning applies to the number of idle calls and idle sleeps to get the proper average of sleep time per idle invocation.
Preserve those fields too.
--- kernel/time/tick-sched.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/time/tick-sched.c +5 -0
@@ -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