Re: can cgroup(cpu,mem) limit qemu and obtain right usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/8/21 04:50, longguang.yue wrote:
> Hi, all:
>     kata runs qemu as a kubernetes pod and use cgroup to limit cpu/memory. 
> my question are :
>       1. how libvirt obtain qemu's cpu and memory usage, how about
> non-root mode cpu usage?

By parsing /proc/$qemu-pid/task/$vcpu-tid/stat, or for stats of qemu
itself just /proc/$qemu-pid/stat. We have an API that we don't like to
talk about that parses cgroups: virCgroupGetPercpuStats() and
virCgroupGetDomainTotalCpuStats().

>       2. if qemu is limited in cgroups , does that usage include
>  non-root mode cpu usage?  

What do you mean by non-root mode? Each vcpu is in its own cgroup, main
QEMU thread is in emulator/ sub-group, and so is every iothread. There's
nothing running in the "root" group.

But since you brought it up, maybe it's time for Kata to start looking
in libvirt's direction? This is all solved here ;-)

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux