android_kernel_xiaomi_sm8350/arch/arm
Matt Helsley dc52ddc0e6 container freezer: implement freezer cgroup subsystem
This patch implements a new freezer subsystem in the control groups
framework.  It provides a way to stop and resume execution of all tasks in
a cgroup by writing in the cgroup filesystem.

The freezer subsystem in the container filesystem defines a file named
freezer.state.  Writing "FROZEN" to the state file will freeze all tasks
in the cgroup.  Subsequently writing "RUNNING" will unfreeze the tasks in
the cgroup.  Reading will return the current state.

* Examples of usage :

   # mkdir /containers/freezer
   # mount -t cgroup -ofreezer freezer  /containers
   # mkdir /containers/0
   # echo $some_pid > /containers/0/tasks

to get status of the freezer subsystem :

   # cat /containers/0/freezer.state
   RUNNING

to freeze all tasks in the container :

   # echo FROZEN > /containers/0/freezer.state
   # cat /containers/0/freezer.state
   FREEZING
   # cat /containers/0/freezer.state
   FROZEN

to unfreeze all tasks in the container :

   # echo RUNNING > /containers/0/freezer.state
   # cat /containers/0/freezer.state
   RUNNING

This is the basic mechanism which should do the right thing for user space
task in a simple scenario.

It's important to note that freezing can be incomplete.  In that case we
return EBUSY.  This means that some tasks in the cgroup are busy doing
something that prevents us from completely freezing the cgroup at this
time.  After EBUSY, the cgroup will remain partially frozen -- reflected
by freezer.state reporting "FREEZING" when read.  The state will remain
"FREEZING" until one of these things happens:

	1) Userspace cancels the freezing operation by writing "RUNNING" to
		the freezer.state file
	2) Userspace retries the freezing operation by writing "FROZEN" to
		the freezer.state file (writing "FREEZING" is not legal
		and returns EIO)
	3) The tasks that blocked the cgroup from entering the "FROZEN"
		state disappear from the cgroup's set of tasks.

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: export thaw_process]
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Acked-by: Serge E. Hallyn <serue@us.ibm.com>
Tested-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-20 08:52:34 -07:00
..
boot
common Merge branch 'pxa-all' into devel 2008-10-09 21:33:02 +01:00
configs Merge branch 'omap-all' into devel 2008-10-14 22:24:42 +01:00
include/asm [PATCH] remove unused ibcs2/PER_SVR4 in SET_PERSONALITY 2008-10-16 15:40:05 +02:00
kernel Merge branch 's3c-move' into devel 2008-10-14 22:24:51 +01:00
lib Merge branch 'ptebits' into devel 2008-10-09 21:31:56 +01:00
mach-aaec2000
mach-at91 Merge branch 'pxa-all' into devel 2008-10-09 21:33:02 +01:00
mach-clps711x
mach-clps7500
mach-davinci Merge branch 's3c-move' into devel 2008-10-14 22:24:51 +01:00
mach-ebsa110
mach-ep93xx Merge branch 'pxa-all' into devel 2008-10-09 21:33:02 +01:00
mach-footbridge Merge branch 'pxa-all' into devel 2008-10-09 21:33:02 +01:00
mach-h720x Merge branch 'pxa-all' into devel 2008-10-09 21:33:02 +01:00
mach-imx Merge branch 'for-rmk' of git://pasiphae.extern.pengutronix.de/git/imx/linux-2.6.git 2008-10-09 21:33:03 +01:00
mach-integrator cpufreq: remove policy->governor setting in drivers initialization 2008-10-15 16:42:47 -07:00
mach-iop13xx Merge branch 'pxa-all' into devel 2008-10-09 21:33:02 +01:00
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-ixp23xx Merge branch 'pxa-all' into devel 2008-10-09 21:33:02 +01:00
mach-ixp2000 Merge branch 'pxa-all' into devel 2008-10-09 21:33:02 +01:00
mach-kirkwood Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2008-10-11 10:09:45 -07:00
mach-ks8695 Merge branches 'machtypes', 'core', 'ep93xx', 'ks8695', 'netdev' and 'sa1100' into devel 2008-10-09 21:31:54 +01:00
mach-l7200
mach-lh7a40x Merge branch 'pxa-all' into devel 2008-10-09 21:33:02 +01:00
mach-loki Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2008-10-11 10:09:45 -07:00
mach-msm
mach-mv78xx0 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2008-10-11 10:09:45 -07:00
mach-mx2
mach-mx3 Merge branch 'for-rmk' of git://source.mvista.com/git/linux-davinci-2.6.git 2008-10-09 21:33:05 +01:00
mach-netx Merge branch 'pxa-all' into devel 2008-10-09 21:33:02 +01:00
mach-ns9xxx Merge branch 'pxa-all' into devel 2008-10-09 21:33:02 +01:00
mach-omap1 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2008-10-16 11:25:32 -07:00
mach-omap2 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2008-10-16 11:25:32 -07:00
mach-orion5x Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog 2008-10-12 11:51:32 -07:00
mach-pnx4008
mach-pxa Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2008-10-16 11:25:32 -07:00
mach-realview
mach-rpc
mach-s3c2400
mach-s3c2410 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2008-10-16 11:25:32 -07:00
mach-s3c2412 Merge branch 's3c-move' into devel 2008-10-14 22:24:51 +01:00
mach-s3c2440 Merge branch 's3c-move' into devel 2008-10-14 22:24:51 +01:00
mach-s3c2442 Merge branch 's3c-move' into devel 2008-10-14 22:24:51 +01:00
mach-s3c2443 Merge branch 's3c-move' into devel 2008-10-14 22:24:51 +01:00
mach-sa1100 cpufreq: remove policy->governor setting in drivers initialization 2008-10-15 16:42:47 -07:00
mach-shark
mach-versatile Merge branch 's3c-move' into devel 2008-10-14 22:24:51 +01:00
mm Merge branch 'omap-all' into devel 2008-10-14 22:24:42 +01:00
nwfpe
oprofile
plat-iop
plat-mxc Merge branch 'for-rmk' of git://pasiphae.extern.pengutronix.de/git/imx/linux-2.6.git 2008-10-09 21:33:03 +01:00
plat-omap Merge branch 'fixes' into for-linus 2008-10-15 23:16:07 +01:00
plat-orion
plat-s3c
plat-s3c24xx Merge branch 's3c-move' into devel 2008-10-14 22:24:51 +01:00
tools
vfp
Kconfig container freezer: implement freezer cgroup subsystem 2008-10-20 08:52:34 -07:00
Kconfig-nommu
Kconfig.debug
Makefile Merge branch 's3c-move' into devel 2008-10-14 22:24:51 +01:00