aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMatt Helsley <matthltc@us.ibm.com>2008-10-18 23:27:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 11:52:34 -0400
commitdc52ddc0e6f45b04780b26fc0813509f8e798c42 (patch)
tree384826e9fab4e434bc5c85ce744470ae472e52c3 /arch
parent8174f1503f4bf7e9a14b3fbbfdb30c6be6e29f77 (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig1
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/avr32/Kconfig2
-rw-r--r--arch/blackfin/Kconfig3
-rw-r--r--arch/cris/Kconfig2
-rw-r--r--arch/frv/Kconfig2
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/m32r/Kconfig2
-rw-r--r--arch/m68k/Kconfig2
-rw-r--r--arch/m68knommu/Kconfig2
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mn10300/Kconfig2
-rw-r--r--arch/parisc/Kconfig2
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/s390/Kconfig2
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sparc/Kconfig2
-rw-r--r--arch/sparc64/Kconfig1
-rw-r--r--arch/um/Kconfig2
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/xtensa/Kconfig1
22 files changed, 41 insertions, 0 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index a0f642b6a4b9..6110197757a3 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -70,6 +70,7 @@ config AUTO_IRQ_AFFINITY
70 default y 70 default y
71 71
72source "init/Kconfig" 72source "init/Kconfig"
73source "kernel/Kconfig.freezer"
73 74
74 75
75menu "System setup" 76menu "System setup"
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4853f9df37bd..df39d20f7425 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -192,6 +192,8 @@ config VECTORS_BASE
192 192
193source "init/Kconfig" 193source "init/Kconfig"
194 194
195source "kernel/Kconfig.freezer"
196
195menu "System Type" 197menu "System Type"
196 198
197choice 199choice
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 7c239a916275..33a5b2969eb4 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -72,6 +72,8 @@ config GENERIC_BUG
72 72
73source "init/Kconfig" 73source "init/Kconfig"
74 74
75source "kernel/Kconfig.freezer"
76
75menu "System Type and features" 77menu "System Type and features"
76 78
77source "kernel/time/Kconfig" 79source "kernel/time/Kconfig"
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 8102c79aaa94..29e71ed6b8a7 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -64,8 +64,11 @@ config HARDWARE_PM
64 depends on OPROFILE 64 depends on OPROFILE
65 65
66source "init/Kconfig" 66source "init/Kconfig"
67
67source "kernel/Kconfig.preempt" 68source "kernel/Kconfig.preempt"
68 69
70source "kernel/Kconfig.freezer"
71
69menu "Blackfin Processor Options" 72menu "Blackfin Processor Options"
70 73
71comment "Processor and Board Settings" 74comment "Processor and Board Settings"
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 9389d38f222f..07335e719bf8 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -62,6 +62,8 @@ config HZ
62 62
63source "init/Kconfig" 63source "init/Kconfig"
64 64
65source "kernel/Kconfig.freezer"
66
65menu "General setup" 67menu "General setup"
66 68
67source "fs/Kconfig.binfmt" 69source "fs/Kconfig.binfmt"
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index a5aac1b07562..9d1552a9ee2c 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -66,6 +66,8 @@ mainmenu "Fujitsu FR-V Kernel Configuration"
66 66
67source "init/Kconfig" 67source "init/Kconfig"
68 68
69source "kernel/Kconfig.freezer"
70
69 71
70menu "Fujitsu FR-V system setup" 72menu "Fujitsu FR-V system setup"
71 73
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index c7966746fbfe..bd1995403c67 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -90,6 +90,8 @@ config HZ
90 90
91source "init/Kconfig" 91source "init/Kconfig"
92 92
93source "kernel/Kconfig.freezer"
94
93source "arch/h8300/Kconfig.cpu" 95source "arch/h8300/Kconfig.cpu"
94 96
95menu "Executable file formats" 97menu "Executable file formats"
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 3b7aa38254a8..912c57db2d21 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -7,6 +7,8 @@ mainmenu "IA-64 Linux Kernel Configuration"
7 7
8source "init/Kconfig" 8source "init/Kconfig"
9 9
10source "kernel/Kconfig.freezer"
11
10menu "Processor type and features" 12menu "Processor type and features"
11 13
12config IA64 14config IA64
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 00289c178f89..dbaed4a63815 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -42,6 +42,8 @@ config HZ
42 42
43source "init/Kconfig" 43source "init/Kconfig"
44 44
45source "kernel/Kconfig.freezer"
46
45 47
46menu "Processor type and features" 48menu "Processor type and features"
47 49
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 677c93a490f6..836fb66f080d 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -62,6 +62,8 @@ mainmenu "Linux/68k Kernel Configuration"
62 62
63source "init/Kconfig" 63source "init/Kconfig"
64 64
65source "kernel/Kconfig.freezer"
66
65menu "Platform dependent setup" 67menu "Platform dependent setup"
66 68
67config EISA 69config EISA
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index 0a8998315e5e..76b66feb74df 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -75,6 +75,8 @@ config NO_IOPORT
75 75
76source "init/Kconfig" 76source "init/Kconfig"
77 77
78source "kernel/Kconfig.freezer"
79
78menu "Processor type and features" 80menu "Processor type and features"
79 81
80choice 82choice
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b905744d7915..5f149b030c0f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1885,6 +1885,8 @@ config PROBE_INITRD_HEADER
1885 add initrd or initramfs image to the kernel image. 1885 add initrd or initramfs image to the kernel image.
1886 Otherwise, say N. 1886 Otherwise, say N.
1887 1887
1888source "kernel/Kconfig.freezer"
1889
1888menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)" 1890menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)"
1889 1891
1890config HW_HAS_EISA 1892config HW_HAS_EISA
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index dd557c9cf001..9a9f43358879 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -68,6 +68,8 @@ mainmenu "Matsushita MN10300/AM33 Kernel Configuration"
68 68
69source "init/Kconfig" 69source "init/Kconfig"
70 70
71source "kernel/Kconfig.freezer"
72
71 73
72menu "Matsushita MN10300 system setup" 74menu "Matsushita MN10300 system setup"
73 75
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 8313fccced5e..2bd1f6ef5db0 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -90,6 +90,8 @@ config ARCH_MAY_HAVE_PC_FDC
90 90
91source "init/Kconfig" 91source "init/Kconfig"
92 92
93source "kernel/Kconfig.freezer"
94
93 95
94menu "Processor type and features" 96menu "Processor type and features"
95 97
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 380baa1780e9..9391199d9e77 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -230,6 +230,8 @@ config PPC_OF_PLATFORM_PCI
230 230
231source "init/Kconfig" 231source "init/Kconfig"
232 232
233source "kernel/Kconfig.freezer"
234
233source "arch/powerpc/sysdev/Kconfig" 235source "arch/powerpc/sysdev/Kconfig"
234source "arch/powerpc/platforms/Kconfig" 236source "arch/powerpc/platforms/Kconfig"
235 237
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index bc581d8a7cd9..70b7645ce745 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -78,6 +78,8 @@ config S390
78 78
79source "init/Kconfig" 79source "init/Kconfig"
80 80
81source "kernel/Kconfig.freezer"
82
81menu "Base setup" 83menu "Base setup"
82 84
83comment "Processor type and features" 85comment "Processor type and features"
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 5131d50f851a..2ed5713b7540 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -106,6 +106,8 @@ config IO_TRAPPED
106 106
107source "init/Kconfig" 107source "init/Kconfig"
108 108
109source "kernel/Kconfig.freezer"
110
109menu "System type" 111menu "System type"
110 112
111# 113#
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 97671dac12a6..e594559c8dba 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -37,6 +37,8 @@ config HZ
37 37
38source "init/Kconfig" 38source "init/Kconfig"
39 39
40source "kernel/Kconfig.freezer"
41
40menu "General machine setup" 42menu "General machine setup"
41 43
42config SMP 44config SMP
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 5446e2a499b1..035b15af90d8 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -96,6 +96,7 @@ config GENERIC_HARDIRQS_NO__DO_IRQ
96 def_bool y 96 def_bool y
97 97
98source "init/Kconfig" 98source "init/Kconfig"
99source "kernel/Kconfig.freezer"
99 100
100menu "Processor type and features" 101menu "Processor type and features"
101 102
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 6976812cfb18..393bccfe1785 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -229,6 +229,8 @@ endmenu
229 229
230source "init/Kconfig" 230source "init/Kconfig"
231 231
232source "kernel/Kconfig.freezer"
233
232source "drivers/block/Kconfig" 234source "drivers/block/Kconfig"
233 235
234source "arch/um/Kconfig.char" 236source "arch/um/Kconfig.char"
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index bd3c2c53873e..49349ba77d80 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -193,6 +193,7 @@ config X86_TRAMPOLINE
193config KTIME_SCALAR 193config KTIME_SCALAR
194 def_bool X86_32 194 def_bool X86_32
195source "init/Kconfig" 195source "init/Kconfig"
196source "kernel/Kconfig.freezer"
196 197
197menu "Processor type and features" 198menu "Processor type and features"
198 199
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 02e417d3d8e9..a213260b51e5 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -55,6 +55,7 @@ config HZ
55 default 100 55 default 100
56 56
57source "init/Kconfig" 57source "init/Kconfig"
58source "kernel/Kconfig.freezer"
58 59
59menu "Processor type and features" 60menu "Processor type and features"
60 61