From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon@bugzilla.kernel.org Subject: [Bug 55061] cpu stats reported in cgroup file is erroneous Date: Tue, 26 Mar 2013 17:24:51 +0000 (UTC) Message-ID: <20130326172451.3C63311F94A@bugzilla.kernel.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" To: kvm@vger.kernel.org Return-path: Received: from mail.kernel.org ([198.145.19.201]:54678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751726Ab3CZRZB (ORCPT ); Tue, 26 Mar 2013 13:25:01 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 90C522037B for ; Tue, 26 Mar 2013 17:24:56 +0000 (UTC) Received: from bugzilla.kernel.org (bugzilla.kernel.org [198.145.19.217]) by mail.kernel.org (Postfix) with ESMTP id DE83F20318 for ; Tue, 26 Mar 2013 17:24:51 +0000 (UTC) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: https://bugzilla.kernel.org/show_bug.cgi?id=55061 --- Comment #2 from Roopa Govind 2013-03-26 17:24:51 --- (In reply to comment #1) > user_time and system_time reported by virsh are from the point of view of the > domain on the host machine. Assuming it is QEMU, the stats reported are for the > QEMU process which is created when VM is started. > Agree, it is reported under cpuacct.usage file under the // cgroup. > A while 1 loop inside VM would only change the vcpu_time and cpu_time. > Therefore, user_time or system_time would not be modified at all. cgroups > inside the VM is proper place to look for the stats you are looking for. I beg to disagree here. I performed this test. For my guest my 1. # of vcpus = # of host cpus 2. Used cpu load generator (https://github.com/beloglazov/cpu-load-generator) inside the guest to generate 90% load for 600 seconds. #python cpu-load-generator.py -n 4 600 test.data test.data has values 90 and 80 (for generating 90% and 80% load) 3. changed the cpu shares for my cgroup / to 4096 and to my rest of the system to 200 using cgset 4. Now ran a sar utility on the host with following options sar -u ALL 1 600 and i could see that my %guest utilization percentage shot up to ~90% and ~80% respectively and %idle was showing ~10% and ~20% while the cpu-load generator was running inside the guest. As soon as the cpu-load-generator stopped the cpu utilization drastically reduced to 95% idle and 5% utilization. When I observed the cgroup cpuacct.usage file for my guest under /, i found that user time < system time. Now i repeated steps 1-4 with a twist. Before start of my cpu-load-generator in my guest, i cleared the cpuacct.usage file to 0 value using the cgset -r cpuacct.usage=0 / and reran the whole steps. Now I could find that my user time was drastically improving compared to system time in cpuacct.usage file. So it does report it correctly if I set the values to 0 before starting my test. Let me know if you like to see some screenshots, i can provide you the same. Thank You for looking into this. -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug.