* [PATCH] tick-sched: Preserve number of idle sleeps across CPU hotplug events
@ 2024-01-22 23:35 Tim Chen
2024-01-24 19:30 ` Thomas Gleixner
2024-01-25 8:58 ` [tip: timers/urgent] tick/sched: " tip-bot2 for Tim Chen
0 siblings, 2 replies; 5+ messages in thread
From: Tim Chen @ 2024-01-22 23:35 UTC (permalink / raw)
To: Heiko Carstens, Thomas Gleixner, Ingo Molnar, Frederic Weisbecker
Cc: Tim Chen, Gerald Schaefer, Alexander Gordeev, Vasily Gorbik,
linux-kernel, linux-s390
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@linux.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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] tick-sched: Preserve number of idle sleeps across CPU hotplug events
2024-01-22 23:35 [PATCH] tick-sched: Preserve number of idle sleeps across CPU hotplug events Tim Chen
@ 2024-01-24 19:30 ` Thomas Gleixner
2024-01-24 20:11 ` Frederic Weisbecker
2024-01-25 8:58 ` [tip: timers/urgent] tick/sched: " tip-bot2 for Tim Chen
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2024-01-24 19:30 UTC (permalink / raw)
To: Tim Chen, Heiko Carstens, Ingo Molnar, Frederic Weisbecker
Cc: Tim Chen, Gerald Schaefer, Alexander Gordeev, Vasily Gorbik,
linux-kernel, linux-s390
On Mon, Jan 22 2024 at 15:35, Tim Chen wrote:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=71fee48fb772ac4f6cfa63dbebc5629de8b4cc09
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tick-sched: Preserve number of idle sleeps across CPU hotplug events
2024-01-24 19:30 ` Thomas Gleixner
@ 2024-01-24 20:11 ` Frederic Weisbecker
2024-01-25 8:45 ` Thomas Gleixner
0 siblings, 1 reply; 5+ messages in thread
From: Frederic Weisbecker @ 2024-01-24 20:11 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Tim Chen, Heiko Carstens, Ingo Molnar, Gerald Schaefer,
Alexander Gordeev, Vasily Gorbik, linux-kernel, linux-s390
Le Wed, Jan 24, 2024 at 08:30:28PM +0100, Thomas Gleixner a écrit :
> On Mon, Jan 22 2024 at 15:35, Tim Chen wrote:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=71fee48fb772ac4f6cfa63dbebc5629de8b4cc09
>
It's a different patch :-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tick-sched: Preserve number of idle sleeps across CPU hotplug events
2024-01-24 20:11 ` Frederic Weisbecker
@ 2024-01-25 8:45 ` Thomas Gleixner
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2024-01-25 8:45 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Tim Chen, Heiko Carstens, Ingo Molnar, Gerald Schaefer,
Alexander Gordeev, Vasily Gorbik, linux-kernel, linux-s390
On Wed, Jan 24 2024 at 21:11, Frederic Weisbecker wrote:
> Le Wed, Jan 24, 2024 at 08:30:28PM +0100, Thomas Gleixner a écrit :
>> On Mon, Jan 22 2024 at 15:35, Tim Chen wrote:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=71fee48fb772ac4f6cfa63dbebc5629de8b4cc09
>>
>
> It's a different patch :-)
I clearly can't read ....
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip: timers/urgent] tick/sched: Preserve number of idle sleeps across CPU hotplug events
2024-01-22 23:35 [PATCH] tick-sched: Preserve number of idle sleeps across CPU hotplug events Tim Chen
2024-01-24 19:30 ` Thomas Gleixner
@ 2024-01-25 8:58 ` tip-bot2 for Tim Chen
1 sibling, 0 replies; 5+ messages in thread
From: tip-bot2 for Tim Chen @ 2024-01-25 8:58 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Tim Chen, Thomas Gleixner, stable, x86, linux-kernel
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 <tim.c.chen@linux.intel.com>
AuthorDate: Mon, 22 Jan 2024 15:35:34 -08:00
Committer: Thomas Gleixner <tglx@linutronix.de>
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.
Fixes: 71fee48f ("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
---
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 d250167..01fb50c 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-25 8:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-22 23:35 [PATCH] tick-sched: Preserve number of idle sleeps across CPU hotplug events Tim Chen
2024-01-24 19:30 ` Thomas Gleixner
2024-01-24 20:11 ` Frederic Weisbecker
2024-01-25 8:45 ` Thomas Gleixner
2024-01-25 8:58 ` [tip: timers/urgent] tick/sched: " tip-bot2 for Tim Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox