Skip to contentSkip to conversation

- Containers: Documentation on using containers

PATCH In review Rohit Seth 5 participants 9 messages Sep 15, 2006 – Sep 19, 2006 Documentation

lore
Share & tools
lore

Rohit Seth

author
#0 lore raw

PATCH 1/5 - Containers: Documentation on using containers

This patch contains the Documentation for using containers.

 Documentation/containers.txt |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+)
Documentation/containers.txt +42 -0
@@ -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
#1 lore raw

Documentation/containers.txt line 27

Quoted 4 lines · Rohit Seth

This patch contains the Documentation for using containers.

+5- Remove a task from container

Documentation/containers.txt +1 -0
+	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

author
#3 lore raw
Quoted 8 lines · Kir Kolyshkin
Quoted 5 lines · Rolf Eike Beer

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

author
#4 lore raw
In reply to Rolf Eike Beer
Quoted 8 lines · Rolf Eike Beer

Documentation/containers.txt line 27

Quoted 4 lines · Rohit Seth

This patch contains the Documentation for using containers.

+5- Remove a task from container

Documentation/containers.txt +1 -0
+	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)

Quoted 3 lines

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

#5 lore raw
Quoted 10 lines · Rohit Seth
Quoted 8 lines · Rolf Eike Beer

Documentation/containers.txt line 27

Quoted 4 lines · Rohit Seth

This patch contains the Documentation for using containers.

+5- Remove a task from container

Documentation/containers.txt +1 -0
+	echo <pid> rmtask

echo <pid> > rmtask?

Quoted 4 lines

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 ;)

Quoted 24 lines
Quoted 4 lines

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.

Quoted 2 lines

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

author
#6 lore raw
Quoted 11 lines · Björn Steinbrink
Quoted 10 lines · Rohit Seth
Quoted 8 lines · Rolf Eike Beer

Documentation/containers.txt line 27

Quoted 4 lines · Rohit Seth

This patch contains the Documentation for using containers.

+5- Remove a task from container

Documentation/containers.txt +1 -0
+	echo <pid> rmtask

echo <pid> > rmtask?

Quoted 8 lines
Quoted 4 lines

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.

Quoted 24 lines
Quoted 24 lines
Quoted 4 lines

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.

Quoted 7 lines
Quoted 2 lines

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

#7 lore raw
In reply to Rohit Seth

On Thu, 14 Sep 2006 18:38:33 PDT, Rohit Seth said:

(Sorry for the late reply...)

Documentation/containers.txt line 27

Quoted 5 lines
Documentation/containers.txt +2 -0
 
+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?

Documentation/containers.txt line 42

Quoted 3 lines

+9- Freeing a container

Documentation/containers.txt +2 -0
+	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?

author
#8 lore raw
Quoted 8 lines · On Tue, 2006-09-19 at 11:32 -0400, [email protected] wrote:

On Thu, 14 Sep 2006 18:38:33 PDT, Rohit Seth said:

(Sorry for the late reply...)

Quoted 2 lines
Documentation/containers.txt +0 -0
Quoted 8 lines

Documentation/containers.txt line 27

Quoted 2 lines

+5- Remove a task from container

Documentation/containers.txt +1 -0
+	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.

Quoted 8 lines

Documentation/containers.txt line 42

Quoted 3 lines

+9- Freeing a container

Documentation/containers.txt +2 -0
+	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.

Quoted 2 lines

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