[libvirt] lxc: dominfo.cpuTime support using cgroups.cpuacct

Hi, This patch enables to get CPU usage of a lxc using cpuacct subsystem of cgroups. Thanks, ozaki-r

On Thu, Mar 05, 2009 at 02:34:48AM +0900, Ryota Ozaki wrote:
Hi,
This patch enables to get CPU usage of a lxc using cpuacct subsystem of cgroups.
This is a great idea - I didn't realize Cgroups had this capability. The patch looks good to me Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Thu, Mar 05, 2009 at 02:34:48AM +0900, Ryota Ozaki wrote:
Hi,
This patch enables to get CPU usage of a lxc using cpuacct subsystem of cgroups.
Looks cool, what kernel version is required to make use of this ? The kernel patch seems to be from last december, but I'm not sure. I would just prefer to make sure it's in a released kernel version before applying the patch here :-) Patch looks fine to me, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Fri, Mar 06, 2009 at 02:27:04PM +0100, Daniel Veillard wrote:
On Thu, Mar 05, 2009 at 02:34:48AM +0900, Ryota Ozaki wrote:
Hi,
This patch enables to get CPU usage of a lxc using cpuacct subsystem of cgroups.
Looks cool, what kernel version is required to make use of this ? The kernel patch seems to be from last december, but I'm not sure. I would just prefer to make sure it's in a released kernel version before applying the patch here :-)
It is in 2.6.27 because I can see it there on my Fedora 9 box after doing # mount -t cgroup none /mnt/cg # ls /mnt/cg cpuacct.usage cpuset.memory_pressure_enabled devices.deny cpuset.cpu_exclusive cpuset.memory_spread_page devices.list cpuset.cpus cpuset.memory_spread_slab notify_on_release cpuset.mem_exclusive cpuset.mems release_agent cpuset.mem_hardwall cpuset.sched_load_balance tasks cpuset.memory_migrate cpuset.sched_relax_domain_level cpuset.memory_pressure devices.allow The Linux kernel support for containers is still incomplete, so I don't think it is worth fixing on a long term minimum kernel version for LXC just yet. We still need the PTS filesystem virtualization before you can consider LXC a reasonably secure container and I don't think that's until 2.6.30. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Hi Daniel, On Fri, Mar 6, 2009 at 11:28 PM, Daniel P. Berrange <berrange@redhat.com> wrote:
On Fri, Mar 06, 2009 at 02:27:04PM +0100, Daniel Veillard wrote:
On Thu, Mar 05, 2009 at 02:34:48AM +0900, Ryota Ozaki wrote:
Hi,
This patch enables to get CPU usage of a lxc using cpuacct subsystem of cgroups.
Looks cool, what kernel version is required to make use of this ? The kernel patch seems to be from last december, but I'm not sure. I would just prefer to make sure it's in a released kernel version before applying the patch here :-)
It is in 2.6.27 because I can see it there on my Fedora 9 box after doing
# mount -t cgroup none /mnt/cg # ls /mnt/cg cpuacct.usage cpuset.memory_pressure_enabled devices.deny cpuset.cpu_exclusive cpuset.memory_spread_page devices.list cpuset.cpus cpuset.memory_spread_slab notify_on_release cpuset.mem_exclusive cpuset.mems release_agent cpuset.mem_hardwall cpuset.sched_load_balance tasks cpuset.memory_migrate cpuset.sched_relax_domain_level cpuset.memory_pressure devices.allow
The Linux kernel support for containers is still incomplete, so I don't think it is worth fixing on a long term minimum kernel version for LXC just yet. We still need the PTS filesystem virtualization before you can consider LXC a reasonably secure container and I don't think that's until 2.6.30.
2.6.29 will include 'devpts multiple instances' feature so I hope LXC in the next released kernel will be secure enough. I'm missing anything? Thanks, ozaki-r
Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Hi Daniel, On Fri, Mar 6, 2009 at 10:27 PM, Daniel Veillard <veillard@redhat.com> wrote:
On Thu, Mar 05, 2009 at 02:34:48AM +0900, Ryota Ozaki wrote:
Hi,
This patch enables to get CPU usage of a lxc using cpuacct subsystem of cgroups.
Looks cool, what kernel version is required to make use of this ? The kernel patch seems to be from last december, but I'm not sure. I would just prefer to make sure it's in a released kernel version before applying the patch here :-)
Actually I didn't know that ;-), but... $ git-checkout v2.6.23 Previous HEAD position was 4991408... Linux 2.6.24 HEAD is now at bbf25010f... Linux 2.6.23 $ grep -r cpuacct kernel |wc -l 0 $ git-checkout v2.6.24 Previous HEAD position was bbf25010f... Linux 2.6.23 Checking out files: 100% (10210/10210), done. HEAD is now at 4991408... Linux 2.6.24 $ grep -r cpuacct kernel |wc -l 27 ok, it must be at v2.6.24! Thanks, ozaki-r
Patch looks fine to me,
thanks !
Daniel
-- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Fri, Mar 06, 2009 at 11:30:26PM +0900, Ryota Ozaki wrote:
Hi Daniel,
On Fri, Mar 6, 2009 at 10:27 PM, Daniel Veillard <veillard@redhat.com> wrote:
On Thu, Mar 05, 2009 at 02:34:48AM +0900, Ryota Ozaki wrote:
Hi,
This patch enables to get CPU usage of a lxc using cpuacct subsystem of cgroups.
Looks cool, what kernel version is required to make use of this ? The kernel patch seems to be from last december, but I'm not sure. I would just prefer to make sure it's in a released kernel version before applying the patch here :-)
Actually I didn't know that ;-), but...
$ git-checkout v2.6.23 Previous HEAD position was 4991408... Linux 2.6.24 HEAD is now at bbf25010f... Linux 2.6.23 $ grep -r cpuacct kernel |wc -l 0 $ git-checkout v2.6.24 Previous HEAD position was bbf25010f... Linux 2.6.23 Checking out files: 100% (10210/10210), done. HEAD is now at 4991408... Linux 2.6.24 $ grep -r cpuacct kernel |wc -l 27
ok, it must be at v2.6.24!
That's certainly good enough - lets commit this to libvirt Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Fri, Mar 06, 2009 at 11:30:26PM +0900, Ryota Ozaki wrote:
Hi Daniel,
On Fri, Mar 6, 2009 at 10:27 PM, Daniel Veillard <veillard@redhat.com> wrote:
On Thu, Mar 05, 2009 at 02:34:48AM +0900, Ryota Ozaki wrote:
Hi,
This patch enables to get CPU usage of a lxc using cpuacct subsystem of cgroups.
Looks cool, what kernel version is required to make use of this ? The kernel patch seems to be from last december, but I'm not sure. I would just prefer to make sure it's in a released kernel version before applying the patch here :-)
Actually I didn't know that ;-), but... [...] ok, it must be at v2.6.24!
Okay, it's mature enough :-) Sorry I should have checked locally instead ! Applied and commited, thanks a lot ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Ryota Ozaki