cgroup cpuacct.stats underreports cpu usage

Bug #1497447 reported by Steve Niemitz
8
This bug affects 1 person
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.Thread(target=do_it)
  t.start()

threading.Event().wait()
EOF

observe process CPU usage in top (depending on system ~80 - 120%)
move into a cpuacct cgroup:

cd /sys/fs/cgroup/cpuacct
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-3.8.0-44-generic 3.8.0-44.66~precise1
ProcVersionSignature: Ubuntu 3.8.0-44.66~precise1-generic 3.8.13.25
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=UUID=a9509269-b6ce-4739-b237-d1fc96077c82
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-256color
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcFB: 0 VESA VGA
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-3.8.0-44-generic root=/dev/mapper/hostname-root ro quiet
RelatedPackageVersions:
 linux-restricted-modules-3.8.0-44-generic N/A
 linux-backports-modules-3.8.0-44-generic N/A
 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:bvninnotekGmbH:bvrVirtualBox:bd12/01/2006:svninnotekGmbH:pnVirtualBox:pvr1.2:rvnOracleCorporation:rnVirtualBox:rvr1.2:cvnOracleCorporation:ct1:cvr:
dmi.product.name: VirtualBox
dmi.product.version: 1.2
dmi.sys.vendor: innotek GmbH

Revision history for this message
Steve Niemitz (steveniemitz) wrote :
penalvch (penalvch)
affects: linux-lts-raring (Ubuntu) → linux-lts-trusty (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.