cgroup cpuacct.stats underreports cpu usage
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux-lts-trusty (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
I've reproduced this in both 3.8 and 3.13.0-64.104 kernel versions, on both VirtualBox and in AWS.
From doing some experiments, it seems like the more threads running in the cgroup, the more cpuacct.stats underreports. If I run this example with one thread, both top and cpuacct.stat report 100% cpu.
To reproduce:
Run this python script in the background:
python << EOF
import threading
import time
def do_it():
n = 0
while True:
n += 1
for n in range(0, 15):
t = threading.
t.start()
threading.
EOF
observe process CPU usage in top (depending on system ~80 - 120%)
move into a cpuacct cgroup:
cd /sys/fs/
mkdir test
echo [pid] > cgroup.procs
Watch the change in cpuacct.stat:
cat cpuacct.stat && sleep 1 && cat cpuacct.stat
In my test top reported ~106% CPU while cpuacct.stat over 1 second reported .61 (61%)
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: linux-image-
ProcVersionSign
Uname: Linux 3.8.0-44-generic x86_64
AlsaDevices:
total 0
crw-rw---T 1 root audio 116, 1 Sep 16 07:46 seq
crw-rw---T 1 root audio 116, 33 Sep 16 07:46 timer
AplayDevices: Error: [Errno 2] No such file or directory
ApportVersion: 2.0.1-0ubuntu17.9
Architecture: amd64
ArecordDevices: Error: [Errno 2] No such file or directory
AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/seq', '/dev/snd/timer'] failed with exit code 1:
CRDA: Error: [Errno 2] No such file or directory
Date: Fri Sep 18 13:16:32 2015
HibernationDevice: RESUME=
InstallationMedia: Ubuntu-Server 12.04 LTS "Precise Pangolin" - Release amd64 (20120424.1)
IwConfig: Error: [Errno 2] No such file or directory
Lsusb: Error: command ['lsusb'] failed with exit code 1: unable to initialize libusb: -99
MachineType: innotek GmbH VirtualBox
MarkForUpload: True
PciMultimedia:
ProcEnviron:
TERM=xterm-
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
ProcFB: 0 VESA VGA
ProcKernelCmdLine: BOOT_IMAGE=
RelatedPackageV
linux-
linux-
linux-firmware 1.79.18
RfKill: Error: [Errno 2] No such file or directory
SourcePackage: linux-lts-raring
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 12/01/2006
dmi.bios.vendor: innotek GmbH
dmi.bios.version: VirtualBox
dmi.board.name: VirtualBox
dmi.board.vendor: Oracle Corporation
dmi.board.version: 1.2
dmi.chassis.type: 1
dmi.chassis.vendor: Oracle Corporation
dmi.modalias: dmi:bvninnotekG
dmi.product.name: VirtualBox
dmi.product.
dmi.sys.vendor: innotek GmbH
affects: | linux-lts-raring (Ubuntu) → linux-lts-trusty (Ubuntu) |