2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 20:53:53 +08:00
linux-next/lib/math
Oleg Nesterov 3dc167ba57 sched/cputime: Improve cputime_adjust()
People report that utime and stime from /proc/<pid>/stat become very
wrong when the numbers are big enough, especially if you watch these
counters incrementally.

Specifically, the current implementation of: stime*rtime/total,
results in a saw-tooth function on top of the desired line, where the
teeth grow in size the larger the values become. IOW, it has a
relative error.

The result is that, when watching incrementally as time progresses
(for large values), we'll see periods of pure stime or utime increase,
irrespective of the actual ratio we're striving for.

Replace scale_stime() with a math64.h helper: mul_u64_u64_div_u64()
that is far more accurate. This also allows architectures to override
the implementation -- for instance they can opt for the old algorithm
if this new one turns out to be too expensive for them.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200519172506.GA317395@hirez.programming.kicks-ass.net
2020-06-15 14:10:00 +02:00
..
cordic.c
div64.c sched/cputime: Improve cputime_adjust() 2020-06-15 14:10:00 +02:00
gcd.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
int_pow.c
int_sqrt.c
Kconfig lib: Make prime number generator independently selectable 2020-06-02 10:25:20 -06:00
lcm.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
prime_numbers.c lib/math: avoid trailing newline hidden in pr_fmt() 2020-06-04 19:06:24 -07:00
rational.c lib/math/rational.c: fix possible incorrect result from rational fractions helper 2019-12-04 19:44:13 -08:00
reciprocal_div.c