Skip to content

RFC RSS controller for containers

Balbir Singh linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest8 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8Fix resource groups parsing, while assigning shareskernel/res_group/rgcs.c+6 -00 replies
2/8RSS controller setupinclude/linux/memctlr.h init/Kconfig kernel/res_group/Makefile +1 more+137 -00 replies
3/8RSS controller add callbackskernel/res_group/memctlr.c+55 -30 replies
4/8RSS controller accountinginclude/linux/memctlr.h include/linux/rmap.h include/linux/sched.h +3 more+145 -52 replies
5/8RSS controller task migration supportfs/proc/base.c include/linux/memctlr.h include/linux/rmap.h +5 more+236 -270 replies
6/8RSS controller shares allocationkernel/res_group/memctlr.c+58 -14 replies
7/8RSS controller fix resource groups parsingkernel/res_group/rgcs.c+6 -02 replies
8/8RSS controller support reclamationinclude/linux/memctlr.h kernel/fork.c kernel/res_group/memctlr.c +2 more+260 -186 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC][PATCH 0/8] RSS controller for containers

Here is set of patches that implements a *simple minded* RSS controller for containers. It would be nice to split up the memory controller design and implementation in phases

1. RSS control
2. Page Cache control (with split clean and dirty accounting/control)
3. mlock() control
4. Kernel accounting and control

The beancounter implementation follows a very similar approach. The split up makes the design of the controller easier. RSS for example, can be tracked per mm_struct. Page Cache could be tracked per inode, per thread or per mm_struct (depending on what form is most suitable).

The definition of RSS was debated on lkml, please see

	http://lkml.org/lkml/2006/10/10/130

This patchset is a proof of concept implementation and the accounting can be easily adapted to meet the definition of RSS as and when it is re-defined or revisited. The changes required should be small.

The reclamation logic has been borrowed from Dave Hansen's challenged memory controller and from shrink_all_memory(). The accounting was inspired from Rohit Seth's container patches.

The good
--------

No additional pointers required in struct page.
There is also a lot of scope for code reuse in tracking the rss of a process (this reuse is yet to be exploited).

The not so good
---------------
The patches contain a lot of debugging code.

Applying the patches
--------------------
This patchset has been developed on top of 2.6.19-rc2 with the latest containers patch applied.

To run and test this patch, additional fixes are required.

Please see

	http://lkml.org/lkml/2006/11/6/10
	http://lkml.org/lkml/2006/11/6/245

Series
------
container-res-groups-fix-parsing.patch
container-memctlr-setup.patch
container-memctlr-callbacks.patch
container-memctlr-acct.patch
container-memctlr-task-migration.patch
container-memctlr-shares.patch
container-memctlr-reclaim.patch

Setup
-----
To test the series, here's what you need to do

0. Get the latest containers patches against 2.6.19-rc2
1. Apply all the fixes
2. Apply these patches
3. Build the kernel and mount the container filesystem mount -t container container /container

4. Disable cpuset's (to simply assignment of tasks to resource groups)

cd /container
echo 0 > cpuset_enabled

5. Add the current task to a new group

mkdir /container/a
echo $$ > tasks
cat memctlr_stats

6. Set limits

echo "res=memctlr,max_shares=10" > memctlr_shares

7. Spin the system, hang it, revolve it, crash it!!
8. Please provide feedback, both code review and any thing else that can be useful for further development

Testing
-------
Kernbench was run on these patches and it did not show any significant overhead in the tests.

Signature · 3 lines
	Balbir Singh,
	Linux Technology Center,
	IBM Software Labs