Messages in this thread | | | From | Li Hua <> | Subject | Re: [PATCH -next] sched/cputime: Fix the bug of reading time backward from /proc/stat | Date | Wed, 17 Aug 2022 08:44:45 +0800 |
| |
It's unreadable, I'm sorry about that.
The CPU statistics time read from /proc/stat should only be incremented. The bug I found is that the value read latest is smaller than the former.
The root cause of the problem is that the "vtime->utime" and "delta" are temporarily added to the stack and show to the user. The value of 'vtime->utime + delta' depends on which task the CPU is executing. As bellow: show_stat -> kcpustat_cpu_fetch -> kcpustat_cpu_fetch_vtime -> cpustat[CPUTIME_USER] += vtime->utime + delta
| |