From 9057b41fcbf509a6dd2cefe8be31c7181e3c905c Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sat, 10 Mar 2018 15:08:49 +0100 Subject: [PATCH] Change condition used in workaround for CPU coming back online Compare counter's value to ULLONG_MAX - 0x7ffff (and not ULLONG_MAX & 0x80000) to guess if it has overflown. Signed-off-by: Sebastien GODARD --- rd_stats.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rd_stats.c b/rd_stats.c index 2c8c967..8b578dd 100644 --- a/rd_stats.c +++ b/rd_stats.c @@ -432,13 +432,13 @@ unsigned long long get_per_cpu_interval(struct stats_cpu *scc, * avoid getting an interval value < 0. * (I don't know how the other fields like hardirq, steal... behave). * Don't assume the CPU has come back from offline state if previous - * value was greater than ULLONG_MAX & 0x80000 (the counter probably + * value was greater than ULLONG_MAX - 0x7ffff (the counter probably * overflew). */ - if ((scc->cpu_idle < scp->cpu_idle) && (scp->cpu_idle < (ULLONG_MAX & 0x80000))) { + if ((scc->cpu_idle < scp->cpu_idle) && (scp->cpu_idle < (ULLONG_MAX - 0x7ffff))) { scp->cpu_idle = 0; } - if ((scc->cpu_iowait < scp->cpu_iowait) && (scp->cpu_iowait < (ULLONG_MAX & 0x80000))) { + if ((scc->cpu_iowait < scp->cpu_iowait) && (scp->cpu_iowait < (ULLONG_MAX - 0x7ffff))) { scp->cpu_iowait = 0; } -- 2.40.0