From owner-freebsd-bugs@freebsd.org Fri Nov 3 22:16:17 2017 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF4B6E5C700 for ; Fri, 3 Nov 2017 22:16:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A034275C97 for ; Fri, 3 Nov 2017 22:16:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id vA3MGHKb031236 for ; Fri, 3 Nov 2017 22:16:17 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 171811] [patch] rctl(8) cputime is too high Date: Fri, 03 Nov 2017 22:16:17 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 10.0-CURRENT X-Bugzilla-Keywords: patch X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: olevole@olevole.ru X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Nov 2017 22:16:17 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D171811 olevole@olevole.ru changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |olevole@olevole.ru --- Comment #3 from olevole@olevole.ru --- Since this problem can not be fixed for a long time it may be the best solu= tion to add one more line into 'BUGS' of rctl(8) https://man.freebsd.org/rctl/8 At the moment (end of 2017) this problem has not been fixed in any supported FreeBSD version and this problem makes it impossible to have the correct statistics on the jail and makes it dangerous for people who use a billing system based on RACCT. This problem also affects 'pcpu' metrics ( %CPU, in percents of a single CPU core ) and can be easy to reproduce on single core: 1) Run jail1 2) Try to execute ant fast/light external command (e.g. /bin/ls ) in the lo= op. Or compile this sample as /root/a.out in jail: --- #include int main() { return 0 } --- Write execution loop and drop it into jail, e.g /root/run.sh: --- #!/bin/sh while [ 1 ]; do /root/a.out > /dev/null done --- Run inside jail this script via: cpuset -c -l 0 /bin/sh /root/run.sh After this we can see on the 'top -P': --- 182 processes: 2 running, 180 sleeping CPU 0: 34.1% user, 0.0% nice, 65.9% system, 0.0% interrupt, 0.0% idle CPU 1: 0.5% user, 0.0% nice, 0.0% system, 0.0% interrupt, 99.5% idle CPU 2: 3.1% user, 0.0% nice, 1.2% system, 0.0% interrupt, 95.7% idle CPU 3: 0.0% user, 0.0% nice, 0.4% system, 0.0% interrupt, 99.6% idle CPU 4: 1.2% user, 0.0% nice, 0.8% system, 0.0% interrupt, 98.1% idle CPU 5: 0.8% user, 0.0% nice, 0.4% system, 0.0% interrupt, 98.8% idle CPU 6: 1.2% user, 0.0% nice, 0.0% system, 0.0% interrupt, 98.8% idle CPU 7: 0.4% user, 0.0% nice, 0.4% system, 0.0% interrupt, 99.2% idle ... PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND 41437 root 1 76 0 11408K 2232K CPU0 0 0:07 12.79% sh ... --- Only one core is busy. However if we look at the RACCT from the hoster side= , we see the following picture: freebsd:~ # rctl -u jail:jail1 | grep pcpu pcpu=3D25600 freebsd:~ # rctl -u jail:jail1 | grep pcpu pcpu=3D25600 freebsd:~ # rctl -u jail:jail1 | grep pcpu pcpu=3D25600 Unfortunately this is not an unlikely reproduction of the problem. Similar you can see in real life very often, for example at the configurati= on stage when a large number of commands are executed: Try to execute in the jail, for example: env BATCH=3Dno make -C /usr/ports/misc/mc clean configure And you will see the problem of statistics again --=20 You are receiving this mail because: You are the assignee for the bug.=