Skip to content

guest time accounting

Laurent Vivier kvm lkml virtualization 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 35 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2introduce a new field in cpustatfs/proc/proc_misc.c include/linux/kernel_stat.h+11 -50 replies
2/2modify account_system_time() to add cputime to cpustat->guestdrivers/kvm/svm.c drivers/kvm/vmx.c include/linux/sched.h +1 more+12 -11 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2][KVM] guest time accounting

The aim of these two patches is to measure the CPU time used by a virtual machine. All comments are welcome... I'm not sure it's the good way to do that.

[PATCH 1/2] introduce a new field, "guest", in cpustat to store the time used by the CPU to run virtual CPU. Modify /proc/stat to display this new field.

[PATCH 2/2] modify account_system_time() to add cputime to cpustat->guest if we are running a VCPU. We add this cputime to cpustat->user instead of cpustat->system because this part of KVM code is in fact user code although it is executed in the kernel. We duplicate VCPU time between guest and user to allow an unmodified "top(1)" to display correct value. A modified "top(1)" is able to display good cpu user time and cpu guest time by subtracting cpu guest time from cpu user time.

Signature · 2 lines
------------- [email protected]  --------------
          "Software is hard" - Donald Knuth