OpenVZ Forum


Home » Mailing lists » Devel » [Patch 01/05]- Containers: Documentation on using containers
[Patch 01/05]- Containers: Documentation on using containers [message #6368] Fri, 15 September 2006 01:38 Go to next message
Rohit Seth is currently offline  Rohit Seth
Messages: 101
Registered: August 2006
Senior Member
This patch contains the Documentation for using containers.

Signed-off-by: Rohit Seth <rohitseth@google.com>

Documentation/containers.txt | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+)

--- linux-2.6.18-rc6-mm2.org/Documentation/containers.txt 1969-12-31 16:00:00.000000000 -0800
+++ linux-2.6.18-rc6-mm2.ctn/Documentation/containers.txt 2006-09-14 17:13:48.000000000 -0700
@@ -0,0 +1,42 @@
+This file contains information about how to use containers. Configfs support
+is needed in kernel as the container's user interface is through configfs. So
+first enable CONFIG_CONFIGFS_FS and CONFIG_CONTAINERS and recompile the kernel.
+
+1- Mount a configfs (for example):
+ mount -t configfs none /mnt/configfs
+ This will create a /mnt/configfs mount point.
+
+2- As the support of containers is built into kernel, so the mount point
+ /mnt/configfs will automatically contain a directory "containers"
+
+3- Create a container by name test_container
+ cd /mnt/configfs/containers
+ mkdir test_container
+
+All the current implemented attributes in the kernel will show up in the
+directory /configfs/containers/test_container
+
+4- Add a task to container
+ cd /mnt/configfs/cotnainers/test_container
+ echo <pid> > addtask
+
+Now the <pid> and its subsequently forked children will belong to container
+test_container.
+
+5- Remove a task from container
+ echo <pid> rmtask
+
+6- Set a page limit for the container
+ echo some_number_of_pages > page_limit
+
+7- Read the id for the container
+ cat id
+
+8- Get the statistics for this container
+ cat num* (will print active pages, anon_pages, file_pages, num_files,
+ and num_task)
+ cat *hits (will print page_limit_hits and task_limit_hits: the number
+ of times container has gone over page_limit and task_limit)
+9- Freeing a container
+ cd /mnt/configfs/containers/
+ rmdir test_container
Re: [Patch 01/05]- Containers: Documentation on using containers [message #6387 is a reply to message #6368] Fri, 15 September 2006 06:15 Go to previous messageGo to next message
Rolf Eike Beer is currently offline  Rolf Eike Beer
Messages: 1
Registered: September 2006
Junior Member
Rohit Seth wrote:
> This patch contains the Documentation for using containers.

> +5- Remove a task from container
> + echo <pid> rmtask

echo <pid> > rmtask?

Please also give a short description what containers are for. From what I read
here I can only guess it's about gettings some statistics about a group of
tasks.

Eike
Re: Re: [Patch 01/05]- Containers: Documentation on using containers [message #6392 is a reply to message #6387] Fri, 15 September 2006 10:12 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Rolf Eike Beer wrote:
> Please also give a short description what containers are for. From
> what I read
> here I can only guess it's about gettings some statistics about a group of
> tasks.
>
Container is like FreeBSD Jail on steroids (and Jail is chroot() on
steroids).

As a nice intro, I suggest you to read
http://en.wikipedia.org/wiki/Operating-system_level_virtuali zation
http://en.wikipedia.org/wiki/OpenVZ
Re: [Patch 01/05]- Containers: Documentation on using containers [message #6408 is a reply to message #6387] Fri, 15 September 2006 16:45 Go to previous messageGo to next message
Rohit Seth is currently offline  Rohit Seth
Messages: 101
Registered: August 2006
Senior Member
On Fri, 2006-09-15 at 08:15 +0200, Rolf Eike Beer wrote:
> Rohit Seth wrote:
> > This patch contains the Documentation for using containers.
>
> > +5- Remove a task from container
> > + echo <pid> rmtask
>
> echo <pid> > rmtask?
>

rmtask is an attribute defined in test_container directory. So, first
you have to cd into container directory
(cd /mnt/configfs/containers/test_container and then execute this
command)

> Please also give a short description what containers are for. From what I read
> here I can only guess it's about gettings some statistics about a group of
> tasks.

Containers allow different workloads to be run on the same platform with
limits defined on per container basis. This basically allows a single
platform to be (soft) partitioned among different workloads (each of
which could be running many tasks). The limits could be amount of
memory, number of tasks among other features. These two features are
already implemented in the patch set that I posted. But it is possible
to add other controllers like CPU that allows only finite amount of time
to the processes belonging to a container.

Currently this patch set is only tracking user memory (both file based
and anonymous). The memory handler is currently deactivating pages
belonging to a container that has gone over the limit. Even though this
allows containers to go over board their limits but 1- once they are
over the limit then they run in degraded manner and 2- if there is any
memory pressure then the (extra) pages belonging to this container are
the prime candidates for swapping (for example). The statistics that
are shown in each container directory are the current values of each
resource consumption.

Please let me know if you need any more specific information about the
patch set.

-rohit
Re: Re: [Patch 01/05]- Containers: Documentation on using containers [message #6409 is a reply to message #6392] Fri, 15 September 2006 16:46 Go to previous messageGo to next message
Rohit Seth is currently offline  Rohit Seth
Messages: 101
Registered: August 2006
Senior Member
On Fri, 2006-09-15 at 14:12 +0400, Kir Kolyshkin wrote:
> Rolf Eike Beer wrote:
> > Please also give a short description what containers are for. From
> > what I read
> > here I can only guess it's about gettings some statistics about a group of
> > tasks.
> >
> Container is like FreeBSD Jail on steroids (and Jail is chroot() on
> steroids).


Nice choice of words!

-rohit
Re: [Patch 01/05]- Containers: Documentation on using containers [message #6413 is a reply to message #6368] Fri, 15 September 2006 18:19 Go to previous messageGo to next message
Rohit Seth is currently offline  Rohit Seth
Messages: 101
Registered: August 2006
Senior Member
On Fri, 2006-09-15 at 19:44 +0200, Björn Steinbrink wrote:
> On 2006.09.15 09:45:25 -0700, Rohit Seth wrote:
> > On Fri, 2006-09-15 at 08:15 +0200, Rolf Eike Beer wrote:
> > > Rohit Seth wrote:
> > > > This patch contains the Documentation for using containers.
> > >
> > > > +5- Remove a task from container
> > > > + echo <pid> rmtask
> > >
> > > echo <pid> > rmtask?
> > >
> >
> > rmtask is an attribute defined in test_container directory. So, first
> > you have to cd into container directory
> > (cd /mnt/configfs/containers/test_container and then execute this
> > command)
>
> The > is missing in the patch though, guess that's what Rolf wanted to
> point out ;)
>
Aha. Will fix it.

> >
> > > Please also give a short description what containers are for. From what I read
> > > here I can only guess it's about gettings some statistics about a group of
> > > tasks.
> >
> > Containers allow different workloads to be run on the same platform with
> > limits defined on per container basis. This basically allows a single
> > platform to be (soft) partitioned among different workloads (each of
> > which could be running many tasks). The limits could be amount of
> > memory, number of tasks among other features. These two features are
> > already implemented in the patch set that I posted. But it is possible
> > to add other controllers like CPU that allows only finite amount of time
> > to the processes belonging to a container.
> >
> > Currently this patch set is only tracking user memory (both file based
> > and anonymous). The memory handler is currently deactivating pages
> > belonging to a container that has gone over the limit. Even though this
> > allows containers to go over board their limits but 1- once they are
> > over the limit then they run in degraded manner and 2- if there is any
> > memory pressure then the (extra) pages belonging to this container are
> > the prime candidates for swapping (for example). The statistics that
> > are shown in each container directory are the current values of each
> > resource consumption.
> >
> > Please let me know if you need any more specific information about the
> > patch set.
>
> A general description for the containers needs to go into Documentation/
> along with the usage example, so that potential users know what to do
> with it. The above seems fine, just remove the "this patch" references.
>

Okay.

Thanks,
-rohit
Re: [Patch 01/05]- Containers: Documentation on using containers [message #6415 is a reply to message #6408] Fri, 15 September 2006 17:44 Go to previous messageGo to next message
B.Steinbrink is currently offline  B.Steinbrink
Messages: 2
Registered: September 2006
Junior Member
On 2006.09.15 09:45:25 -0700, Rohit Seth wrote:
> On Fri, 2006-09-15 at 08:15 +0200, Rolf Eike Beer wrote:
> > Rohit Seth wrote:
> > > This patch contains the Documentation for using containers.
> >
> > > +5- Remove a task from container
> > > + echo <pid> rmtask
> >
> > echo <pid> > rmtask?
> >
>
> rmtask is an attribute defined in test_container directory. So, first
> you have to cd into container directory
> (cd /mnt/configfs/containers/test_container and then execute this
> command)

The > is missing in the patch though, guess that's what Rolf wanted to
point out ;)

>
> > Please also give a short description what containers are for. From what I read
> > here I can only guess it's about gettings some statistics about a group of
> > tasks.
>
> Containers allow different workloads to be run on the same platform with
> limits defined on per container basis. This basically allows a single
> platform to be (soft) partitioned among different workloads (each of
> which could be running many tasks). The limits could be amount of
> memory, number of tasks among other features. These two features are
> already implemented in the patch set that I posted. But it is possible
> to add other controllers like CPU that allows only finite amount of time
> to the processes belonging to a container.
>
> Currently this patch set is only tracking user memory (both file based
> and anonymous). The memory handler is currently deactivating pages
> belonging to a container that has gone over the limit. Even though this
> allows containers to go over board their limits but 1- once they are
> over the limit then they run in degraded manner and 2- if there is any
> memory pressure then the (extra) pages belonging to this container are
> the prime candidates for swapping (for example). The statistics that
> are shown in each container directory are the current values of each
> resource consumption.
>
> Please let me know if you need any more specific information about the
> patch set.

A general description for the containers needs to go into Documentation/
along with the usage example, so that potential users know what to do
with it. The above seems fine, just remove the "this patch" references.

Björn
Re: [Patch 01/05]- Containers: Documentation on using containers [message #6511 is a reply to message #6368] Tue, 19 September 2006 16:30 Go to previous message
Rohit Seth is currently offline  Rohit Seth
Messages: 101
Registered: August 2006
Senior Member
On Tue, 2006-09-19 at 11:32 -0400, Valdis.Kletnieks@vt.edu wrote:
> On Thu, 14 Sep 2006 18:38:33 PDT, Rohit Seth said:
>
> (Sorry for the late reply...)
>
>
> > --- linux-2.6.18-rc6-mm2.org/Documentation/containers.txt 1969-12-31 16:00:00.000000000 -0800
> > +++ linux-2.6.18-rc6-mm2.ctn/Documentation/containers.txt 2006-09-14 17:13:48.000000000 -0700
>
> > +5- Remove a task from container
> > + echo <pid> rmtask
>
> echo <pid> > rmtask
>
> is what I think was intended. Also, I'm not sure <pid> is the best
> meta-syntax - anybody got a better idea?
>

Fixed that.

> > +9- Freeing a container
> > + cd /mnt/configfs/containers/
> > + rmdir test_container
>
> What happens if you try to remove a container that still has active tasks? Are
> you relying on the VFS to catch the 'non-empty directory'? (of course, 'rm -r'
> has predictable semantics here).
>

When a rmdir operation is done on a directory, then all tasks have to
move out of container (before we the rmdir operation is complete). This
removal of tasks from a container is done as part of
container_remove_tasks.

> I see support for "add a task" and "remove a task", but none for listing
> the current tasks in the container?

This is one of the TODO items that I've listed. Will be there soon.

thanks,
-rohit
Re: [Patch 01/05]- Containers: Documentation on using containers [message #6514 is a reply to message #6368] Tue, 19 September 2006 15:32 Go to previous message
Valdis.Kletnieks is currently offline  Valdis.Kletnieks
Messages: 5
Registered: September 2006
Junior Member
On Thu, 14 Sep 2006 18:38:33 PDT, Rohit Seth said:

(Sorry for the late reply...)


> --- linux-2.6.18-rc6-mm2.org/Documentation/containers.txt 1969-12-31 16:00:00.000000000 -0800
> +++ linux-2.6.18-rc6-mm2.ctn/Documentation/containers.txt 2006-09-14 17:13:48.000000000 -0700

> +5- Remove a task from container
> + echo <pid> rmtask

echo <pid> > rmtask

is what I think was intended. Also, I'm not sure <pid> is the best
meta-syntax - anybody got a better idea?

> +9- Freeing a container
> + cd /mnt/configfs/containers/
> + rmdir test_container

What happens if you try to remove a container that still has active tasks? Are
you relying on the VFS to catch the 'non-empty directory'? (of course, 'rm -r'
has predictable semantics here).

I see support for "add a task" and "remove a task", but none for listing
the current tasks in the container?
Previous Topic: [PATCH] BC: resource beancounters (v4) (added user memory)
Next Topic: [Patch03/05]- Containers: Initialization and Configfs interface
Goto Forum:
  


Current Time: Thu Aug 15 07:11:12 GMT 2024

Total time taken to generate the page: 0.02840 seconds