Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
s390, sched/cputime: Make arch_cpu_idle_time() to return nsecs
Browse files Browse the repository at this point in the history
This way we don't need to deal with cputime_t details from the core code.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1485832191-26889-32-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
fweisbec authored and Ingo Molnar committed Feb 1, 2017
1 parent c833d82 commit 42b425b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion arch/s390/include/asm/cputime.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static inline clock_t cputime64_to_clock_t(cputime64_t cputime)
return clock;
}

cputime64_t arch_cpu_idle_time(int cpu);
u64 arch_cpu_idle_time(int cpu);

#define arch_idle_time(cpu) arch_cpu_idle_time(cpu)

Expand Down
5 changes: 3 additions & 2 deletions arch/s390/kernel/idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static ssize_t show_idle_time(struct device *dev,
}
DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL);

cputime64_t arch_cpu_idle_time(int cpu)
u64 arch_cpu_idle_time(int cpu)
{
struct s390_idle_data *idle = &per_cpu(s390_idle, cpu);
unsigned long long now, idle_enter, idle_exit;
Expand All @@ -96,7 +96,8 @@ cputime64_t arch_cpu_idle_time(int cpu)
idle_enter = ACCESS_ONCE(idle->clock_idle_enter);
idle_exit = ACCESS_ONCE(idle->clock_idle_exit);
} while (read_seqcount_retry(&idle->seqcount, seq));
return idle_enter ? ((idle_exit ?: now) - idle_enter) : 0;

return cputime_to_nsecs(idle_enter ? ((idle_exit ?: now) - idle_enter) : 0);
}

void arch_cpu_idle_enter(void)
Expand Down
4 changes: 2 additions & 2 deletions fs/proc/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static u64 get_idle_time(int cpu)

idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
if (cpu_online(cpu) && !nr_iowait_cpu(cpu))
idle += cputime_to_nsecs(arch_idle_time(cpu));
idle += arch_idle_time(cpu);
return idle;
}

Expand All @@ -37,7 +37,7 @@ static u64 get_iowait_time(int cpu)

iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
if (cpu_online(cpu) && nr_iowait_cpu(cpu))
iowait += cputime_to_nsecs(arch_idle_time(cpu));
iowait += arch_idle_time(cpu);
return iowait;
}

Expand Down

0 comments on commit 42b425b

Please sign in to comment.