Commits
Alexey Dobriyan authored and Pavel Emelianov committed 965e7934881
Fix VCPU user=system=nice=idle=0% bug VE has simple idle time collection logic (per VCPU ->strt_idle_time, ->idle_time). For ->idle_time incrementing ->strt_idle_time must not be 0. This happens when the very first task is scheduled on VCPU. Before that all VCPU statistics is zeroed out because of ve = kzalloc(sizeof(struct ve_struct)); including ->strt_idle_time. All this leads to suprising /proc/stat and, as a consequence, top(1) output: # vzctl exec 140 cat /proc/stat cpu 83 0 150 65654 173 0 0 cpu0 66 0 98 64839 167 0 0 cpu1 15 0 47 369 6 0 0 cpu2 0 0 4 446 0 0 0 cpu3 0 0 0 0 0 0 0 <=== cpu4 0 0 0 0 0 0 0 <=== cpu5 0 0 0 0 0 0 0 <=== cpu6 0 0 0 0 0 0 0 <=== cpu7 0 0 0 0 0 0 0 <=== When user, system and nice times are 0%, it's OK. But when idle time is _also_ 0%, it's surprising. The solution is to start idle_time collecting state machine when VCPU is added. As a nice side offect, when you start VE with 2 VCPUs, later add 3-rd, it's idle time will start ticking from the moment of addition. Fixes http://bugzilla.openvz.org/show_bug.cgi?id=366