[Libct] Libct Queries - Service cgroup , process descriptor.

Monali Porob Monali.Porob at huawei.com
Fri Dec 19 12:09:52 PST 2014


Hi Andrew ,
 
Your explanation on process descriptor was well understood . Thanks so much ! 

I tried configuring the container with the memory and service cgroup controller. The ability to get the process list seemed to work as you mentioned and I could get the libct_container_kill() working with the same. 

Qn :After I run the attached test program I noticed that the OS tasks ( or previously running tasks other than the container processes) are moved into the service cgroup controller tasks file namely /sys/fs/cgroups/.libct/tasks . 
Is this a known behavior . Is it OS specific and depends on how named cgroups like systemd are handled by the same. I am using 14.04 Ubuntu .
I see no code in libct moving OS tasks under .libct/tasks file. Any pointers? . 

Regards,
Monali





-----Original Message-----
From: Andrew Vagin [mailto:avagin at parallels.com] 
Sent: Thursday, December 18, 2014 7:24 AM
To: Monali Porob
Cc: libct at openvz.org
Subject: Re: Libct Queries - Service cgroup , process descriptor.

On Tue, Dec 16, 2014 at 11:37:32PM +0000, Monali Porob wrote:
> Hi all ,
> 
>  
> 
> I needed some pointers regarding Service cgroup controller  and 
> process descriptors  .
> 
>  
> 
> Qn1 :  I wanted to understand what use case is supported by the 
> Service cgroup controller.

The Service cgroup controller is required when a container isn't executed in a new pid namespace. In this case we need to have an ability to get a process list which belongs to the container. And we use a sevice group for this.

When a container is running in its own pid namespace, we can list all processes in its pid namespace.

> 
> If I have read the test programs correctly looks like service cgroup 
> controller is created by setting LIBCT_OPT_KILLABLE option. 
> libct_container_kill() can be called on the associated container.
> 
>  
> 
> Qn2 : what is the purpose of the process descriptor 
> (ct_process_desc_t) in context of libct . Why is it associated with a 
> session  rather than a container .

A container is an isolated environment for processes.  The process descriptor describes parameters which are independent from a container configuration (cwd, caps, pdeathsig, uid, gid, groups, etc). The same processes descriptor can be used for executing processes inside several containers. It's a first reason why it is associated with a session.

Another reason is that the process descriptor describes parameters, which are applied when a process is started, and they can't be changed for existing processes. Any changes of existing descriptors don't affect processes which have been started previously.

One more reason is that we can use several descriptors for executing processes in one container, and we can use one descriptor for executing processes in several containers.

> 
>  
> 
> Qn3 : If there are 2 containers in the same session , should there be 
> two calls to the libct_process_desc_create(s);

No, it isn't required. You can use one for both containers.

> When testing the CPU controllers
> configuration for 2 containers ( each running stress program)  in the 
> same session , passing the same process descriptor worked . However in 
> which case would I need to create 2 process descriptors.

Sometimes you want to apply different parameters for processes and in this case it may be convenient to have a few process descriptors.

> 
>  
> 
> Any info regarding this will help.
> 
>  
> 
> Thanks in advance .
> 
> Regards,
> 
> Monali
> 
>  
> 
>  
> 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ct_cgroup_memory_service.c
URL: <http://lists.openvz.org/pipermail/libct/attachments/20141219/fb960f04/attachment.c>


More information about the Libct mailing list