diff options
author | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2022-05-31 15:13:23 +0200 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2022-05-31 15:13:23 +0200 |
commit | 03ab8e6297acd1bc0eedaa050e2a1635c576fd11 (patch) | |
tree | 519b79a60508ae3992f0f6bf10deac237dbc45ae /fs/proc/uptime.c | |
parent | fs/ntfs3: Update valid size if -EIOCBQUEUED (diff) | |
parent | Linux 5.18 (diff) | |
download | linux-03ab8e6297acd1bc0eedaa050e2a1635c576fd11.tar.xz linux-03ab8e6297acd1bc0eedaa050e2a1635c576fd11.zip |
Merge tag 'v5.18'
Linux 5.18
Diffstat (limited to 'fs/proc/uptime.c')
-rw-r--r-- | fs/proc/uptime.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c index 5a1b228964fb..deb99bc9b7e6 100644 --- a/fs/proc/uptime.c +++ b/fs/proc/uptime.c @@ -12,18 +12,22 @@ static int uptime_proc_show(struct seq_file *m, void *v) { struct timespec64 uptime; struct timespec64 idle; - u64 nsec; + u64 idle_nsec; u32 rem; int i; - nsec = 0; - for_each_possible_cpu(i) - nsec += (__force u64) kcpustat_cpu(i).cpustat[CPUTIME_IDLE]; + idle_nsec = 0; + for_each_possible_cpu(i) { + struct kernel_cpustat kcs; + + kcpustat_cpu_fetch(&kcs, i); + idle_nsec += get_idle_time(&kcs, i); + } ktime_get_boottime_ts64(&uptime); timens_add_boottime(&uptime); - idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem); + idle.tv_sec = div_u64_rem(idle_nsec, NSEC_PER_SEC, &rem); idle.tv_nsec = rem; seq_printf(m, "%lu.%02lu %lu.%02lu\n", (unsigned long) uptime.tv_sec, |