Kernel Setup
CONFIG_GROUP_SCHED=y CONFIG_FAIR_GROUP_SCHED=y CONFIG_RT_GROUP_SCHED=y CONFIG_CGROUP_SCHED=y CONFIG_CGROUPS=y CONFIG_CGROUP_NS=y CONFIG_CGROUP_FREEZER=y CONFIG_CGROUP_DEVICE=y CONFIG_CPUSETS=y CONFIG_PROC_PID_CPUSET=y CONFIG_CGROUP_CPUACCT=y CONFIG_RESOURCE_COUNTERS=y CONFIG_CGROUP_MEM_RES_CTLR=y CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y CONFIG_MM_OWNER=y CONFIG_NAMESPACES=y CONFIG_UTS_NS=y CONFIG_IPC_NS=y CONFIG_USER_NS=y CONFIG_PID_NS=y CONFIG_NET_NS=y CONFIG_NET_CLS_CGROUP=y CONFIG_SECURITY_FILE_CAPABILITIES=y CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
1.
root@slitaz:/home/tux# zcat /proc/config.gz | grep CGROUP
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_NS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_MEM_RES_CTLR=y
CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y
CONFIG_CGROUP_MEM_RES_CTLR_SWAP_ENABLED=y
CONFIG_CGROUP_SCHED=y
CONFIG_BLK_CGROUP=y
# CONFIG_DEBUG_BLK_CGROUP is not set
CONFIG_NET_CLS_CGROUP=y
2.
root@slitaz:/home/tux# mount cgroup -t cgroup /sys/fs/cgroup
root@slitaz:/home/tux# mount | grep cgroup
cgroup on /sys/fs/cgroup type cgroup (rw,relatime,blkio,net_cls,freezer,devices,memory,cpuacct,cpu,ns,cpuset)
3.
root@slitaz:/home/tux# tazpkg -gi lxc
root@slitaz:/home/tux# lxc-create -n slitaz-lxc -t busybox
Warning:
-------
Usually the template option is called with a configuration
file option too, mostly to configure the network.
eg. lxc-create -n foo -f lxc.conf -t debian
The configuration file is often:
lxc.network.type=macvlan
lxc.network.link=eth0
lxc.network.flags=up
or alternatively:
lxc.network.type=veth
lxc.network.link=br0
lxc.network.flags=up
For more information look at lxc.conf (5)
At this point, I assume you know what you do.
Press <enter> to continue ...
warning : busybox is not statically linked.
warning : The template script may not correctly
warning : setup the container environment.
chroot: failed to run command `/bin/passwd': No such file or directory
No password for 'root', please change !
'busybox' template installed
'slitaz-lxc' created
root@slitaz:/home/tux# which passwd
/usr/bin/passwd
4.
root@slitaz:/home/tux# ls -l /var/lib/lxc/slitaz-lxc/rootfs
total 64
drwxr-xr-x 2 root root 12288 Nov 1 12:47 bin
drwxr-xr-x 4 root root 4096 Nov 1 12:47 dev
drwxr-xr-x 3 root root 4096 Nov 1 12:47 etc
drwxr-xr-x 2 root root 4096 Nov 1 12:47 home
drwxr-xr-x 2 root root 4096 Nov 1 12:47 lib
drwxr-xr-x 2 root root 4096 Nov 1 12:47 lib64
drwxr-xr-x 2 root root 4096 Nov 1 12:47 mnt
drwxr-xr-x 2 root root 4096 Nov 1 12:47 proc
drwxr-xr-x 2 root root 4096 Nov 1 12:47 root
drwxr-xr-x 2 root root 4096 Nov 1 12:47 sbin
drwxr-xr-x 2 root root 4096 Nov 1 12:47 selinux
drwxr-xr-x 2 root root 4096 Nov 1 12:47 tmp
drwxr-xr-x 5 root root 4096 Nov 1 12:47 usr
drwxr-xr-x 3 root root 4096 Nov 1 12:47 var
root@slitaz:/home/tux# du -sh /var/lib/lxc/slitaz-lxc/rootfs/
748.0K /var/lib/lxc/slitaz-lxc/rootfs/
5.
root@slitaz:/home/tux# cat /var/lib/lxc/slitaz-lxc/config
lxc.utsname = slitaz-lxc
lxc.tty = 1
lxc.pts = 1
lxc.rootfs = /var/lib/lxc/slitaz-lxc/rootfs
lxc.mount.entry=/lib /var/lib/lxc/slitaz-lxc/rootfs/lib none ro,bind 0 0
lxc.mount.entry=/usr/lib /var/lib/lxc/slitaz-lxc/rootfs/usr/lib none ro,bind 0 0
Ref:
1. Control Groups
=================
1.1 What are cgroups ?
----------------------
Control Groups provide a mechanism for aggregating/partitioning sets of tasks, and all their future children, into hierarchical groups with specialized behaviour.
=============
CFS Scheduler
=============
1. OVERVIEW
CFS stands for "Completely Fair Scheduler," and is the new "desktop" process scheduler implemented by Ingo Molnar and merged in Linux 2.6.23. It is the replacement for the previous vanilla scheduler's SCHED_OTHER interactivity code.