Skip to content

Commit c010162

Browse files
committed
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 <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 740d63b commit c010162

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

arch/s390/kernel/idle.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ static DEFINE_PER_CPU(struct s390_idle_data, s390_idle);
2424
void account_idle_time_irq(void)
2525
{
2626
struct s390_idle_data *idle = this_cpu_ptr(&s390_idle);
27+
unsigned long idle_time;
2728
u64 cycles_new[8];
2829
int i;
2930

@@ -42,12 +43,21 @@ void account_idle_time_irq(void)
4243

4344
S390_lowcore.system_timer += S390_lowcore.last_update_timer - idle->timer_idle_enter;
4445
S390_lowcore.last_update_timer = idle->timer_idle_exit;
46+
47+
/* Account time spent with enabled wait psw loaded as idle time. */
48+
raw_write_seqcount_begin(&idle->seqcount);
49+
idle_time = idle->clock_idle_exit - idle->clock_idle_enter;
50+
idle->clock_idle_enter = 0;
51+
idle->clock_idle_exit = 0;
52+
idle->idle_time += idle_time;
53+
idle->idle_count++;
54+
account_idle_time(cputime_to_nsecs(idle_time));
55+
raw_write_seqcount_end(&idle->seqcount);
4556
}
4657

4758
void arch_cpu_idle(void)
4859
{
4960
struct s390_idle_data *idle = this_cpu_ptr(&s390_idle);
50-
unsigned long idle_time;
5161
unsigned long psw_mask;
5262

5363
/* Wait for external, I/O or machine check interrupt. */
@@ -57,15 +67,6 @@ void arch_cpu_idle(void)
5767

5868
/* psw_idle() returns with interrupts disabled. */
5969
psw_idle(idle, psw_mask);
60-
61-
/* Account time spent with enabled wait psw loaded as idle time. */
62-
raw_write_seqcount_begin(&idle->seqcount);
63-
idle_time = idle->clock_idle_exit - idle->clock_idle_enter;
64-
idle->clock_idle_enter = idle->clock_idle_exit = 0ULL;
65-
idle->idle_time += idle_time;
66-
idle->idle_count++;
67-
account_idle_time(cputime_to_nsecs(idle_time));
68-
raw_write_seqcount_end(&idle->seqcount);
6970
raw_local_irq_enable();
7071
}
7172

0 commit comments

Comments
 (0)