"sched/cpuacct: Show all possible CPUs in cpuacct output" broke Docker CPU usage accounting
From: Ian Campbell
Date: Wed Feb 15 2017 - 07:34:31 EST
It seems that the changes to cpuacct.usage(_percpu) in 5ca3726af7f6
("sched/cpuacct: Show all possible CPUs in cpuacct output") have
broken CPU usage accounting in Docker
The issue is the code at
which multiplies by the length of the array on those files which has
gone from being the number of online cpus to the number of possible
cpus, hence inflating the numbers.
I'm not entirely sure what the answer is, mainly because I've not been
able to figure out what the units presented in the cpuacct files are
which would justify multiplying by any version of number of CPUs,
although it does appear to have been (AFAICT) producing the correct
numbers with the old code.
I'm more than happy to code up a fix on whichever side of the boundary
is appropriate given a hint in the correct direction to take...