Skip to content

Commit 9a574ea

Browse files
pdxChenKAGA-KOKO
authored andcommitted
tick/sched: Preserve number of idle sleeps across CPU hotplug events
Commit 71fee48 ("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. Fixes: 71fee48 ("tick-sched: Fix idle and iowait sleeptime accounting vs CPU hotplug") Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240122233534.3094238-1-tim.c.chen@linux.intel.com
1 parent 6446495 commit 9a574ea

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/time/tick-sched.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,7 @@ void tick_cancel_sched_timer(int cpu)
15771577
{
15781578
struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
15791579
ktime_t idle_sleeptime, iowait_sleeptime;
1580+
unsigned long idle_calls, idle_sleeps;
15801581

15811582
# ifdef CONFIG_HIGH_RES_TIMERS
15821583
if (ts->sched_timer.base)
@@ -1585,9 +1586,13 @@ void tick_cancel_sched_timer(int cpu)
15851586

15861587
idle_sleeptime = ts->idle_sleeptime;
15871588
iowait_sleeptime = ts->iowait_sleeptime;
1589+
idle_calls = ts->idle_calls;
1590+
idle_sleeps = ts->idle_sleeps;
15881591
memset(ts, 0, sizeof(*ts));
15891592
ts->idle_sleeptime = idle_sleeptime;
15901593
ts->iowait_sleeptime = iowait_sleeptime;
1594+
ts->idle_calls = idle_calls;
1595+
ts->idle_sleeps = idle_sleeps;
15911596
}
15921597
#endif
15931598

0 commit comments

Comments
 (0)