diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2023-02-06 16:49:39 +0300 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2023-02-09 22:11:22 +0300 |
commit | c01016299dc7db5c7b86107b3e129a18dd683574 (patch) | |
tree | 60a76d5e3cdbb4c8e4fc2969f33111b3764a3ef4 /arch/s390/kernel/idle.c | |
parent | 740d63b5a0595508e041cba825c1ae64385fc6d9 (diff) | |
download | linux-c01016299dc7db5c7b86107b3e129a18dd683574.tar.xz |
s390/idle: move idle time accounting to account_idle_time_irq()
There is no reason to do idle time accounting in arch_cpu_idle().
Do idle time accounting in account_idle_time_irq(), where it belongs
to. The accounted values don't change between account_idle_time_irq() and
arch_cpu_idle(); so the result is the same.
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/kernel/idle.c')
-rw-r--r-- | arch/s390/kernel/idle.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/arch/s390/kernel/idle.c b/arch/s390/kernel/idle.c index a8aebb5c95cf..0c008b30eb03 100644 --- a/arch/s390/kernel/idle.c +++ b/arch/s390/kernel/idle.c @@ -24,6 +24,7 @@ static DEFINE_PER_CPU(struct s390_idle_data, s390_idle); void account_idle_time_irq(void) { struct s390_idle_data *idle = this_cpu_ptr(&s390_idle); + unsigned long idle_time; u64 cycles_new[8]; int i; @@ -42,12 +43,21 @@ void account_idle_time_irq(void) S390_lowcore.system_timer += S390_lowcore.last_update_timer - idle->timer_idle_enter; S390_lowcore.last_update_timer = idle->timer_idle_exit; + + /* Account time spent with enabled wait psw loaded as idle time. */ + raw_write_seqcount_begin(&idle->seqcount); + idle_time = idle->clock_idle_exit - idle->clock_idle_enter; + idle->clock_idle_enter = 0; + idle->clock_idle_exit = 0; + idle->idle_time += idle_time; + idle->idle_count++; + account_idle_time(cputime_to_nsecs(idle_time)); + raw_write_seqcount_end(&idle->seqcount); } void arch_cpu_idle(void) { struct s390_idle_data *idle = this_cpu_ptr(&s390_idle); - unsigned long idle_time; unsigned long psw_mask; /* Wait for external, I/O or machine check interrupt. */ @@ -57,15 +67,6 @@ void arch_cpu_idle(void) /* psw_idle() returns with interrupts disabled. */ psw_idle(idle, psw_mask); - - /* Account time spent with enabled wait psw loaded as idle time. */ - raw_write_seqcount_begin(&idle->seqcount); - idle_time = idle->clock_idle_exit - idle->clock_idle_enter; - idle->clock_idle_enter = idle->clock_idle_exit = 0ULL; - idle->idle_time += idle_time; - idle->idle_count++; - account_idle_time(cputime_to_nsecs(idle_time)); - raw_write_seqcount_end(&idle->seqcount); raw_local_irq_enable(); } |