/proc/stat idle time counting backwards in container

brickZA

New Member
Jun 14, 2012
6
0
1
Hi,

Running the latest proxmox kernel 2.6.32-12-pve I find that the idle time in /proc/stat sometimes counts backwards when the container is loaded. For instance, running the python snippet below in an ubuntu 10.04 LTS container with 4 CPUs (on a host with 24):

Code:
def fn3():     
        print open('/proc/stat').readline()
        [x for x in range(int(2e6))]
        print open('/proc/stat').readline()

i.e. show the first line of /proc/stat, do a CPU busy loop (count to 2 million) then show the first line again, I get:
Code:
cpu  48471 0 10894 2171966 7 0 0 79
cpu  48491 0 10897 2171320 7 0 0 79

The largerst number is the idle time (in jiffies I think), and note how it has decreased. I'm using a library that uses /proc/stat to calculate elapsed time for CPU usage calculations.

If the container is unloaded, it counts forward, i.e. if I change the busy loop with a 1s sleep, I see:

Code:
cpu  48798 0 11096 2247012 7 0 0 80
cpu  48799 0 11097 2247259 7 0 0 80

It seems like it may be fixed in the next openVZ kernel release, see the changelog in http://wiki.openvz.org/Download/kernel/rhel6-testing/042stab056.11 and http://bugzilla.openvz.org/show_bug.cgi?id=2179

Is there a way I can test the kernel from the download link in proxmox?

Thanks
Neilen
 
Hi,

Are there specific instructions available for building the pve kernel? I have compiled kernels before, but that was in the previous century, so I'd appreciate some pointers :)